This is an automated email from the ASF dual-hosted git repository.

openinx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new bb83e42  HBASE-23140 Remove unknown table error (#706)
bb83e42 is described below

commit bb83e423cc6c2102df98e78e864ce1f92e597d31
Author: Karthik Palanisamy <[email protected]>
AuthorDate: Wed Oct 9 01:00:56 2019 -0700

    HBASE-23140 Remove unknown table error (#706)
    
    Signed-off-by: huzheng <[email protected]>
---
 hbase-shell/src/main/ruby/hbase/quotas.rb                  |  1 +
 .../src/main/ruby/shell/commands/describe_namespace.rb     | 14 ++++++++------
 hbase-shell/src/test/ruby/hbase/admin_test.rb              | 11 +++++++++++
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/hbase-shell/src/main/ruby/hbase/quotas.rb 
b/hbase-shell/src/main/ruby/hbase/quotas.rb
index 104ed75..62c54c9 100644
--- a/hbase-shell/src/main/ruby/hbase/quotas.rb
+++ b/hbase-shell/src/main/ruby/hbase/quotas.rb
@@ -30,6 +30,7 @@ java_import org.apache.hadoop.hbase.quotas.QuotaTableUtil
 java_import org.apache.hadoop.hbase.quotas.SpaceViolationPolicy
 
 module HBaseQuotasConstants
+  QUOTA_TABLE_NAME = QuotaTableUtil::QUOTA_TABLE_NAME
   # RPC Quota constants
   GLOBAL_BYPASS = 'GLOBAL_BYPASS'.freeze
   THROTTLE_TYPE = 'THROTTLE_TYPE'.freeze
diff --git a/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb 
b/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
index 4252ad6..fd14c45 100644
--- a/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
@@ -33,14 +33,16 @@ EOF
 
         formatter.header(['DESCRIPTION'], [64])
         formatter.row([desc], true, [64])
-
-        puts
-        formatter.header(%w[QUOTAS])
         ns = namespace.to_s
-        count = quotas_admin.list_quotas(NAMESPACE => ns) do |_, quota|
-          formatter.row([quota])
+        if admin.exists?(::HBaseQuotasConstants::QUOTA_TABLE_NAME.to_s)
+          puts formatter.header(%w[QUOTAS])
+          count = quotas_admin.list_quotas(NAMESPACE => ns) do |_, quota|
+            formatter.row([quota])
+          end
+          formatter.footer(count)
+        else
+          puts 'Quota is disabled'
         end
-        formatter.footer(count)
       end
       # rubocop:enable Metrics/AbcSize
     end
diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb 
b/hbase-shell/src/test/ruby/hbase/admin_test.rb
index cc90fcf..6925f54 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -367,6 +367,17 @@ module Hbase
       assert(output.include?('0 row(s)'))
     end
 
+    define_test 'describe_namespace should return quota disabled' do
+      ns = 'ns'
+      quota_table = ::HBaseQuotasConstants::QUOTA_TABLE_NAME.to_s
+      drop_test_table(quota_table)
+      command(:create_namespace, ns)
+      output = capture_stdout { command(:describe_namespace, ns) }
+      # re-creating quota table otherwise other test case may fail
+      command(:create, quota_table, 'q', 'u')
+      assert(output.include?('Quota is disabled'))
+    end
+
     
#-------------------------------------------------------------------------------
 
     define_test 'truncate should empty a table' do

Reply via email to