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.
This commit is contained in:
parent
6d3339f25e
commit
0c2314b07a
|
@ -319,15 +319,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
|
||||
servers = getServers(admin)
|
||||
# Remove the server we are unloading from from list of servers.
|
||||
# Side-effect is the servername that matches this hostname
|
||||
|
@ -382,8 +380,6 @@ 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)
|
||||
regions = readFile(filename)
|
||||
return if regions.isEmpty()
|
||||
|
@ -504,6 +500,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]
|
||||
|
|
Loading…
Reference in New Issue