joshelser commented on a change in pull request #1935:
URL: https://github.com/apache/hbase/pull/1935#discussion_r453019391



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaUtil.java
##########
@@ -264,7 +265,32 @@ private static void deleteQuotas(final Connection 
connection, final byte[] rowKe
       final byte[] qualifier) throws IOException {
     Delete delete = new Delete(rowKey);
     if (qualifier != null) {
-      delete.addColumns(QUOTA_FAMILY_INFO, qualifier);
+      //Check if delete qualifier is for persisted space quota snapshot usage 
column family
+      if (Arrays.equals(qualifier,QUOTA_QUALIFIER_POLICY)) {
+        delete.addColumns(QUOTA_FAMILY_USAGE, qualifier);
+      } else
+        delete.addColumns(QUOTA_FAMILY_INFO, qualifier);
+    }
+    if (isNamespaceRowKey(rowKey)) {
+      //Check namespace is not deleted before you get info about quota and 
list of tables in namespace
+      NamespaceDescriptor[] descs = 
connection.getAdmin().listNamespaceDescriptors();

Review comment:
       Beware that this requires ADMIN to list descriptors. This might be 
increasing the permissions required to modify quotas.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaUtil.java
##########
@@ -264,7 +265,32 @@ private static void deleteQuotas(final Connection 
connection, final byte[] rowKe
       final byte[] qualifier) throws IOException {
     Delete delete = new Delete(rowKey);
     if (qualifier != null) {
-      delete.addColumns(QUOTA_FAMILY_INFO, qualifier);
+      //Check if delete qualifier is for persisted space quota snapshot usage 
column family
+      if (Arrays.equals(qualifier,QUOTA_QUALIFIER_POLICY)) {
+        delete.addColumns(QUOTA_FAMILY_USAGE, qualifier);
+      } else

Review comment:
       Missing curly-brackets on else-branch

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaUtil.java
##########
@@ -264,7 +265,32 @@ private static void deleteQuotas(final Connection 
connection, final byte[] rowKe
       final byte[] qualifier) throws IOException {
     Delete delete = new Delete(rowKey);
     if (qualifier != null) {
-      delete.addColumns(QUOTA_FAMILY_INFO, qualifier);
+      //Check if delete qualifier is for persisted space quota snapshot usage 
column family
+      if (Arrays.equals(qualifier,QUOTA_QUALIFIER_POLICY)) {
+        delete.addColumns(QUOTA_FAMILY_USAGE, qualifier);
+      } else
+        delete.addColumns(QUOTA_FAMILY_INFO, qualifier);
+    }
+    if (isNamespaceRowKey(rowKey)) {
+      //Check namespace is not deleted before you get info about quota and 
list of tables in namespace
+      NamespaceDescriptor[] descs = 
connection.getAdmin().listNamespaceDescriptors();
+      String ns = getNamespaceFromRowKey(rowKey);
+      int index = 0;
+      while (index < descs.length) {
+        if (ns.equals(descs[index].getName())) {
+          Quotas namespaceQuota = getNamespaceQuota(connection,ns);
+          if (namespaceQuota != null && namespaceQuota.hasSpace()) {
+            TableName[] tableArray = 
connection.getAdmin().listTableNamesByNamespace(ns);
+            for (TableName tableName : tableArray) {
+              deleteQuotas(connection, getTableRowKey(tableName), 
QUOTA_QUALIFIER_POLICY);

Review comment:
       If I override the namespace quota with a table-level quota, will this 
remove my table-level quota too?
   
   e.g. say there is a 10G quota on a namespace, but I further restrict a 
specific table in that namespace to be 1G. I would expect that my table can 
only use 1G at most.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to