hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jya...@apache.org
Subject hbase git commit: HBASE-12428 region_mover.rb script is broken if port is not specified
Date Thu, 06 Nov 2014 21:03:30 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 c07d41df9 -> 6f918c2c0


HBASE-12428 region_mover.rb script is broken if port is not specified

If the port is not specified, there is an object nil exception.


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

Branch: refs/heads/0.98
Commit: 6f918c2c0811e8f7e8a7ca2e4af7dc5e4a1b46b9
Parents: c07d41d
Author: Jesse Yates <jyates@apache.org>
Authored: Thu Nov 6 12:39:41 2014 -0800
Committer: Jesse Yates <jyates@apache.org>
Committed: Thu Nov 6 13:04:58 2014 -0800

----------------------------------------------------------------------
 bin/region_mover.rb | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6f918c2c/bin/region_mover.rb
----------------------------------------------------------------------
diff --git a/bin/region_mover.rb b/bin/region_mover.rb
index 255992a..fa39f04 100644
--- a/bin/region_mover.rb
+++ b/bin/region_mover.rb
@@ -321,15 +321,13 @@ end
 
 # Move regions off the passed hostname:port
 def unloadRegions(options, hostname, port)
-  # Get configuration
-  config = getConfiguration()
   # Clean up any old files.
   filename = getFilename(options, hostname, port)
   deleteFile(filename)
+  # Get configuration
+  config = getConfiguration()
   # Get an admin instance
-  admin = HBaseAdmin.new(config) 
-  port = config.getInt(HConstants::REGIONSERVER_PORT, HConstants::DEFAULT_REGIONSERVER_PORT)
\
-    unless port
+  admin = HBaseAdmin.new(config)
   servers = getServers(admin)
   # Remove the server we are unloading from from list of servers.
   # Side-effect is the servername that matches this hostname 
@@ -384,9 +382,7 @@ def loadRegions(options, hostname, port)
   config = getConfiguration()
   # Get an admin instance
   admin = HBaseAdmin.new(config) 
-  port = config.getInt(HConstants::REGIONSERVER_PORT, HConstants::DEFAULT_REGIONSERVER_PORT)
\
-    unless port
-  filename = getFilename(options, hostname, port) 
+  filename = getFilename(options, hostname, port)
   regions = readFile(filename)
   return if regions.isEmpty()
   servername = nil
@@ -506,6 +502,14 @@ if not hostname
   opts optparse
   exit 2
 end
+
+# Get configuration
+config = getConfiguration()
+if not port
+    port = config.getInt(HConstants::REGIONSERVER_PORT, HConstants::DEFAULT_REGIONSERVER_PORT)
+end
+port = port.to_s
+
 # Create a logger and save it to ruby global
 $LOG = configureLogging(options) 
 case ARGV[0]


Mime
View raw message