hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [42/60] [abbrv] hbase git commit: HBASE-18894: null pointer exception in list_regions in shell command
Date Fri, 06 Oct 2017 04:15:21 GMT
HBASE-18894: null pointer exception in list_regions in shell command

Signed-off-by: Mike Drob <mdrob@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4093cc02
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4093cc02
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4093cc02

Branch: refs/heads/HBASE-18467
Commit: 4093cc0291aa7f00ec75a0bae48841ac85eb1fa5
Parents: 38eaf47
Author: Yi Liang <yliang@us.ibm.com>
Authored: Thu Sep 28 13:07:27 2017 -0700
Committer: Mike Drob <mdrob@apache.org>
Committed: Mon Oct 2 16:50:29 2017 -0500

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/shell/commands/list_regions.rb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4093cc02/hbase-shell/src/main/ruby/shell/commands/list_regions.rb
----------------------------------------------------------------------
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 5feb926..bcc0c4a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb
@@ -77,6 +77,7 @@ EOF
           raise "#{cols} must be an array of strings. Possible values are SERVER_NAME, REGION_NAME,
START_KEY, END_KEY, SIZE, REQ, LOCALITY."
         end
 
+        error = false
         admin_instance = admin.instance_variable_get('@admin')
         conn_instance = admin_instance.getConnection
         cluster_status = admin_instance.getClusterStatus
@@ -105,6 +106,12 @@ EOF
             region_load_map = cluster_status.getLoad(server_name).getRegionsLoad
             region_load = region_load_map.get(hregion_info.getRegionName)
 
+            if region_load.nil?
+              puts "Can not find region: #{hregion_info.getRegionName} , it may be disabled
or in transition\n"
+              error = true
+              break
+            end
+
             # Ignore regions which exceed our locality threshold
             next unless accept_region_for_locality? region_load.getDataLocality, locality_threshold
             result_hash = {}
@@ -157,12 +164,14 @@ EOF
 
         @end_time = Time.now
 
+        return if error
+
         size_hash.each do |param, length|
           printf(" %#{length}s |", param)
         end
         printf("\n")
 
-        size_hash.each do |_param, length|
+        size_hash.each_value do |length|
           str = '-' * length
           printf(" %#{length}s |", str)
         end


Mime
View raw message