HBASE-23140 Remove unknown table error (#706)

Signed-off-by: huzheng <openinx@gmail.com>
This commit is contained in:
Karthik Palanisamy 2019-10-09 01:00:56 -07:00 committed by openinx
parent 6e3a455887
commit bb83e423cc
3 changed files with 20 additions and 6 deletions

View File

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

View File

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

View File

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