Skip to content

Commit

Permalink
HBASE-23140 Remove unknown table error (apache#706)
Browse files Browse the repository at this point in the history
Signed-off-by: huzheng <[email protected]>
  • Loading branch information
Karthik Palanisamy authored and Guanghao Zhang committed Oct 16, 2019
1 parent 8240cdd commit a0cee2c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions hbase-shell/src/main/ruby/hbase/quotas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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
Expand Down
14 changes: 8 additions & 6 deletions hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ def command(namespace)

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
Expand Down
11 changes: 11 additions & 0 deletions hbase-shell/src/test/ruby/hbase/admin_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,17 @@ def teardown
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
Expand Down

0 comments on commit a0cee2c

Please sign in to comment.