This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 76c080b  HBASE-22661 list_regions command in hbase shell is broken
76c080b is described below

commit 76c080b339db4d2e438ba01825fce857db621200
Author: Duo Zhang <[email protected]>
AuthorDate: Mon Jul 15 23:06:43 2019 +0800

    HBASE-22661 list_regions command in hbase shell is broken
    
    Signed-off-by: Guanghao Zhang <[email protected]>
---
 hbase-shell/src/main/ruby/shell/commands/list_regions.rb | 4 ++--
 hbase-shell/src/test/ruby/hbase/admin_test.rb            | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb 
b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb
index 0ce569c..3d6de4c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb
@@ -82,7 +82,7 @@ EOF
         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 = []
@@ -103,7 +103,7 @@ EOF
           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)
diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb 
b/hbase-shell/src/test/ruby/hbase/admin_test.rb
index 65d2eef..a43e394 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -506,6 +506,10 @@ module Hbase
       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

Reply via email to