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
|
# Move regions off the passed hostname:port
|
||||||
def unloadRegions(options, hostname, port)
|
def unloadRegions(options, hostname, port)
|
||||||
# Get configuration
|
|
||||||
config = getConfiguration()
|
|
||||||
# Clean up any old files.
|
# Clean up any old files.
|
||||||
filename = getFilename(options, hostname, port)
|
filename = getFilename(options, hostname, port)
|
||||||
deleteFile(filename)
|
deleteFile(filename)
|
||||||
|
# Get configuration
|
||||||
|
config = getConfiguration()
|
||||||
# Get an admin instance
|
# Get an admin instance
|
||||||
admin = HBaseAdmin.new(config)
|
admin = HBaseAdmin.new(config)
|
||||||
port = config.getInt(HConstants::REGIONSERVER_PORT, HConstants::DEFAULT_REGIONSERVER_PORT) \
|
|
||||||
unless port
|
|
||||||
servers = getServers(admin)
|
servers = getServers(admin)
|
||||||
# Remove the server we are unloading from from list of servers.
|
# Remove the server we are unloading from from list of servers.
|
||||||
# Side-effect is the servername that matches this hostname
|
# Side-effect is the servername that matches this hostname
|
||||||
|
@ -382,8 +380,6 @@ def loadRegions(options, hostname, port)
|
||||||
config = getConfiguration()
|
config = getConfiguration()
|
||||||
# Get an admin instance
|
# Get an admin instance
|
||||||
admin = HBaseAdmin.new(config)
|
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)
|
regions = readFile(filename)
|
||||||
return if regions.isEmpty()
|
return if regions.isEmpty()
|
||||||
|
@ -504,6 +500,14 @@ if not hostname
|
||||||
opts optparse
|
opts optparse
|
||||||
exit 2
|
exit 2
|
||||||
end
|
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
|
# Create a logger and save it to ruby global
|
||||||
$LOG = configureLogging(options)
|
$LOG = configureLogging(options)
|
||||||
case ARGV[0]
|
case ARGV[0]
|
||||||
|
|
Loading…
Reference in New Issue