HBASE-15799 Two Shell 'close_region' Example Syntaxes Don't Work (Matt Warhaftig)
This commit is contained in:
parent
8604f9eebb
commit
3b74b6f329
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue