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_r320857047
 
 

 ##########
 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) {
 
 Review comment:
   Checking the table name is unnecessary if you set the table filter above.

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