HBASE-22661 list_regions command in hbase shell is broken

Signed-off-by: Guanghao Zhang <zghao@apache.org>
This commit is contained in:
Duo Zhang 2019-07-15 23:06:43 +08:00
parent 4211266a81
commit f017e7b8aa
2 changed files with 6 additions and 2 deletions

View File

@ -82,7 +82,7 @@ EOF
error = false error = false
admin_instance = admin.instance_variable_get('@admin') admin_instance = admin.instance_variable_get('@admin')
conn_instance = admin_instance.getConnection conn_instance = admin_instance.getConnection
cluster_status = admin_instance.getClusterStatus cluster_status = org.apache.hadoop.hbase.ClusterStatus.new(admin_instance.getClusterMetrics)
hregion_locator_instance = conn_instance.getRegionLocator(TableName.valueOf(table_name)) hregion_locator_instance = conn_instance.getRegionLocator(TableName.valueOf(table_name))
hregion_locator_list = hregion_locator_instance.getAllRegionLocations.to_a hregion_locator_list = hregion_locator_instance.getAllRegionLocations.to_a
results = [] results = []
@ -103,7 +103,7 @@ EOF
end end
regions.each do |hregion| regions.each do |hregion|
hregion_info = hregion.getRegionInfo hregion_info = hregion.getRegion
server_name = hregion.getServerName server_name = hregion.getServerName
region_load_map = cluster_status.getLoad(server_name).getRegionsLoad region_load_map = cluster_status.getLoad(server_name).getRegionsLoad
region_load = region_load_map.get(hregion_info.getRegionName) region_load = region_load_map.get(hregion_info.getRegionName)

View File

@ -442,6 +442,10 @@ module Hbase
encodedRegionName = region.getRegionInfo().getEncodedName() encodedRegionName = region.getRegionInfo().getEncodedName()
command(:unassign, encodedRegionName, true) command(:unassign, encodedRegionName, true)
end end
define_test "list regions should allow table name" do
command(:list_regions, @test_name)
end
end end
# Simple administration methods tests # Simple administration methods tests