You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by md...@apache.org on 2017/10/02 21:52:39 UTC
[1/2] hbase git commit: HBASE-18894: null pointer exception in
list_regions in shell command
Repository: hbase
Updated Branches:
refs/heads/branch-2 24e40f3e8 -> 176d8bd2c
refs/heads/master 38eaf47fa -> 4093cc029
HBASE-18894: null pointer exception in list_regions in shell command
Signed-off-by: Mike Drob <md...@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/master
Commit: 4093cc0291aa7f00ec75a0bae48841ac85eb1fa5
Parents: 38eaf47
Author: Yi Liang <yl...@us.ibm.com>
Authored: Thu Sep 28 13:07:27 2017 -0700
Committer: Mike Drob <md...@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
[2/2] hbase git commit: HBASE-18894: null pointer exception in
list_regions in shell command
Posted by md...@apache.org.
HBASE-18894: null pointer exception in list_regions in shell command
Signed-off-by: Mike Drob <md...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/176d8bd2
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/176d8bd2
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/176d8bd2
Branch: refs/heads/branch-2
Commit: 176d8bd2c7dcfc7ecb619bd48eb0c4faf94a688c
Parents: 24e40f3
Author: Yi Liang <yl...@us.ibm.com>
Authored: Thu Sep 28 13:07:27 2017 -0700
Committer: Mike Drob <md...@apache.org>
Committed: Mon Oct 2 16:51:34 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/176d8bd2/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