Repository: hbase Updated Branches: refs/heads/branch-2.0 dd94fe9f1 -> d396e4bc0
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 <md...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d396e4bc Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d396e4bc Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d396e4bc Branch: refs/heads/branch-2.0 Commit: d396e4bc075df271edf451bf1a24266f25f9aaf6 Parents: dd94fe9 Author: Peter Somogyi <psomo...@apache.org> Authored: Thu Apr 5 12:12:14 2018 +0200 Committer: Peter Somogyi <psomo...@apache.org> Committed: Sat Apr 7 18:12:46 2018 +0200 ---------------------------------------------------------------------- .../src/main/ruby/shell/commands/list_regions.rb | 2 ++ hbase-shell/src/test/ruby/hbase/admin_test.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/d396e4bc/hbase-shell/src/main/ruby/shell/commands/list_regions.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb index bcc0c4a..0ce569c 100644 --- a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb +++ b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb @@ -50,6 +50,8 @@ EOF options = { SERVER_NAME => options } end + raise "Table #{table_name} must be enabled." unless admin.enabled?(table_name) + size_hash = {} if cols.nil? size_hash = { 'SERVER_NAME' => 12, 'REGION_NAME' => 12, 'START_KEY' => 10, 'END_KEY' => 10, 'SIZE' => 5, 'REQ' => 5, 'LOCALITY' => 10 } http://git-wip-us.apache.org/repos/asf/hbase/blob/d396e4bc/hbase-shell/src/test/ruby/hbase/admin_test.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index 929484c..a27bbc5 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -319,6 +319,18 @@ module Hbase admin.truncate_preserve(@create_test_name, $TEST_CLUSTER.getConfiguration) assert_equal(splits, table(@create_test_name)._get_splits_internal()) 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 # Simple administration methods tests