joshelser commented on a change in pull request #571: HBASE-20821 Re-creating a 
dropped namespace and contained table inherits previously set space quota 
settings
URL: https://github.com/apache/hbase/pull/571#discussion_r320855631
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaUtil.java
 ##########
 @@ -456,6 +470,46 @@ private static TimedQuota updateTimedQuota(TimedQuota 
timedQuota, double factor)
     double getFactor(T t);
   }
 
+  /**
+   * Method to return the space quotas defined on a given table.
+   *
+   * @param conn connection
+   * @param tn   tablename
+   * @return returns space quota settings defined on the table tn otherwise 
null.
+   * @throws IOException throws IOException
+   */
+  public static QuotaSettings getTableSpaceQuota(Connection conn, TableName 
tn) throws IOException {
+    try (QuotaRetriever scanner = QuotaRetriever
+        .open(conn.getConfiguration(), new 
QuotaFilter().setTableFilter(tn.getNameAsString()))) {
+      for (QuotaSettings setting : scanner) {
+        if (setting.getTableName().equals(tn) && setting.getQuotaType() == 
QuotaType.SPACE) {
+          return setting;
+        }
+      }
+      return null;
+    }
+  }
+
+  /**
+   * Retrieve list of tables for the given namespace.
+   *
+   * @param connection Connection
+   * @param namespace  name of the namespace
+   * @return list of tables present inside the namespace otherwise returns 
null.
+   * @throws IOException throws IOException
+   */
+  public static TableName[] listTableNamesByNamepsace(final Connection 
connection, String namespace)
 
 Review comment:
   Seems unnecessary to break this out into its own method if the only consumer 
is `deleteNamespaceQuota`.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to