HBASE-20287 After cluster startup list_regions command fails on disabled table

Add is_enabled check for list_regions command

Signed-off-by: Mike Drob <mdrob@apache.org>
This commit is contained in:
Peter Somogyi 2018-04-05 12:12:14 +02:00
parent dcc1d9e36a
commit 2cfa344ab1
2 changed files with 14 additions and 0 deletions

View File

@ -50,6 +50,8 @@ EOF
options = { SERVER_NAME => options } options = { SERVER_NAME => options }
end end
raise "Table #{table_name} must be enabled." unless admin.enabled?(table_name)
size_hash = {} size_hash = {}
if cols.nil? if cols.nil?
size_hash = { 'SERVER_NAME' => 12, 'REGION_NAME' => 12, 'START_KEY' => 10, 'END_KEY' => 10, 'SIZE' => 5, 'REQ' => 5, 'LOCALITY' => 10 } size_hash = { 'SERVER_NAME' => 12, 'REGION_NAME' => 12, 'START_KEY' => 10, 'END_KEY' => 10, 'SIZE' => 5, 'REQ' => 5, 'LOCALITY' => 10 }

View File

@ -319,6 +319,18 @@ module Hbase
admin.truncate_preserve(@create_test_name, $TEST_CLUSTER.getConfiguration) admin.truncate_preserve(@create_test_name, $TEST_CLUSTER.getConfiguration)
assert_equal(splits, table(@create_test_name)._get_splits_internal()) assert_equal(splits, table(@create_test_name)._get_splits_internal())
end end
#-------------------------------------------------------------------------------
define_test "list_regions should fail for disabled table" do
drop_test_table(@create_test_name)
admin.create(@create_test_name, 'a')
command(:disable, @create_test_name)
assert(:is_disabled, @create_test_name)
assert_raise(RuntimeError) do
command(:list_regions, @create_test_name)
end
end
end end
# Simple administration methods tests # Simple administration methods tests