From a8994afbfeec2c8f33613b3818319591fbe9b9c5 Mon Sep 17 00:00:00 2001 From: Balazs Meszaros Date: Tue, 27 Mar 2018 15:33:54 +0200 Subject: [PATCH] HBASE-20258 Shell hangs when scanning a disabled table Signed-off-by: Mike Drob --- hbase-shell/src/main/ruby/shell/commands.rb | 3 +++ hbase-shell/src/test/ruby/hbase/table_test.rb | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb index 990e978dde2..b4a34077d58 100644 --- a/hbase-shell/src/main/ruby/shell/commands.rb +++ b/hbase-shell/src/main/ruby/shell/commands.rb @@ -114,6 +114,9 @@ module Shell if cause.is_a?(org.apache.hadoop.hbase.TableNotFoundException) raise "Unknown table #{args.first}!" end + if cause.is_a?(org.apache.hadoop.hbase.TableNotEnabledException) + raise "Table #{args.first} is disabled!" + end if cause.is_a?(org.apache.hadoop.hbase.UnknownRegionException) raise "Unknown region #{args.first}!" end diff --git a/hbase-shell/src/test/ruby/hbase/table_test.rb b/hbase-shell/src/test/ruby/hbase/table_test.rb index e7e1b23e410..c1b288c3a49 100644 --- a/hbase-shell/src/test/ruby/hbase/table_test.rb +++ b/hbase-shell/src/test/ruby/hbase/table_test.rb @@ -695,5 +695,16 @@ module Hbase assert_equal(0, splits.size) assert_equal([], splits) end + + define_test "scan should throw an exception on a disabled table" do + @test_table.disable + begin + assert_raise(RuntimeError) do + @test_table.scan + end + ensure + @test_table.enable + end + end end end