Skip to content

Commit

Permalink
HBASE-22661 list_regions command in hbase shell is broken
Browse files Browse the repository at this point in the history
Signed-off-by: Guanghao Zhang <[email protected]>
  • Loading branch information
Apache9 committed Jul 16, 2019
1 parent 4211266 commit f017e7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hbase-shell/src/main/ruby/shell/commands/list_regions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def command(table_name, options = nil, cols = nil)
error = false
admin_instance = admin.instance_variable_get('@admin')
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_list = hregion_locator_instance.getAllRegionLocations.to_a
results = []
Expand All @@ -103,7 +103,7 @@ def command(table_name, options = nil, cols = nil)
end

regions.each do |hregion|
hregion_info = hregion.getRegionInfo
hregion_info = hregion.getRegion
server_name = hregion.getServerName
region_load_map = cluster_status.getLoad(server_name).getRegionsLoad
region_load = region_load_map.get(hregion_info.getRegionName)
Expand Down
4 changes: 4 additions & 0 deletions hbase-shell/src/test/ruby/hbase/admin_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,10 @@ def teardown
encodedRegionName = region.getRegionInfo().getEncodedName()
command(:unassign, encodedRegionName, true)
end

define_test "list regions should allow table name" do
command(:list_regions, @test_name)
end
end

# Simple administration methods tests
Expand Down

0 comments on commit f017e7b

Please sign in to comment.