You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sy...@apache.org on 2016/05/11 04:58:21 UTC
[49/50] [abbrv] hbase git commit: HBASE-15799 Two Shell
'close_region' Example Syntaxes Don't Work (Matt Warhaftig)
HBASE-15799 Two Shell 'close_region' Example Syntaxes Don't Work (Matt Warhaftig)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3b74b6f3
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3b74b6f3
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3b74b6f3
Branch: refs/heads/hbase-12439
Commit: 3b74b6f329ad6ebc0d2d2548a7e1290297674529
Parents: 8604f9e
Author: tedyu <yu...@gmail.com>
Authored: Mon May 9 20:58:55 2016 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Mon May 9 20:58:55 2016 -0700
----------------------------------------------------------------------
hbase-shell/src/main/ruby/hbase/admin.rb | 6 ++--
.../main/ruby/shell/commands/close_region.rb | 1 -
hbase-shell/src/test/ruby/hbase/admin_test.rb | 29 ++++++++++++++++++++
3 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/3b74b6f3/hbase-shell/src/main/ruby/hbase/admin.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb
index 7ea315f..88a6598 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -433,8 +433,10 @@ module Hbase
# If server name is nil, we presume region_name is full region name (HRegionInfo.getRegionName).
# If server name is not nil, we presume it is the region's encoded name (HRegionInfo.getEncodedName)
def close_region(region_name, server)
- if (server == nil || !closeEncodedRegion?(region_name, server))
- @admin.closeRegion(region_name, server)
+ if (region_name.end_with? ".")
+ @admin.closeRegion(region_name, server)
+ else
+ closeEncodedRegion?(region_name, server)
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/3b74b6f3/hbase-shell/src/main/ruby/shell/commands/close_region.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/close_region.rb b/hbase-shell/src/main/ruby/shell/commands/close_region.rb
index 9e2900c..ef1c99c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/close_region.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/close_region.rb
@@ -46,7 +46,6 @@ Examples:
hbase> close_region 'REGIONNAME'
hbase> close_region 'REGIONNAME', 'SERVER_NAME'
- hbase> close_region 'ENCODED_REGIONNAME'
hbase> close_region 'ENCODED_REGIONNAME', 'SERVER_NAME'
EOF
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/3b74b6f3/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 54f7418..50a65d0 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -238,6 +238,35 @@ module Hbase
end
end
+ # Simple administration methods tests
+ class AdminRegionTest < Test::Unit::TestCase
+ include TestHelpers
+ def setup
+ setup_hbase
+ # Create test table if it does not exist
+ @test_name = "hbase_shell_tests_table"
+ drop_test_table(@test_name)
+ create_test_table(@test_name)
+ end
+
+ def teardown
+ shutdown
+ end
+
+ define_test "close_region should allow encoded & non-encoded region names" do
+ region = admin.locate_region(@test_name, '')
+ serverName = region.getServerName().getServerName()
+ regionName = region.getRegionInfo().getRegionNameAsString()
+ encodedRegionName = region.getRegionInfo().getEncodedName()
+
+ # Close region with just region name.
+ admin.close_region(regionName, nil)
+ # Close region with region name and server.
+ admin.close_region(regionName, serverName)
+ admin.close_region(encodedRegionName, serverName)
+ end
+ end
+
# Simple administration methods tests
class AdminAlterTableTest < Test::Unit::TestCase
include TestHelpers