HBASE-21629 draining_servers.rb is broken

This commit is contained in:
Nihal Jain 2018-12-23 14:29:53 +05:30 committed by stack
parent 48786ad4a3
commit 61484fdbfe
1 changed files with 12 additions and 7 deletions

View File

@ -27,6 +27,7 @@ java_import org.apache.hadoop.hbase.HBaseConfiguration
java_import org.apache.hadoop.hbase.client.ConnectionFactory
java_import org.apache.hadoop.hbase.client.HBaseAdmin
java_import org.apache.hadoop.hbase.zookeeper.ZKUtil
java_import org.apache.hadoop.hbase.zookeeper.ZNodePaths
java_import org.slf4j.LoggerFactory
# Name of this script
@ -86,11 +87,11 @@ def addServers(_options, hostOrServers)
servers = getServerNames(hostOrServers, config)
zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil)
parentZnode = zkw.znodePaths.drainingZNode
begin
parentZnode = zkw.getZNodePaths.drainingZNode
for server in servers
node = ZKUtil.joinZNode(parentZnode, server)
node = ZNodePaths.joinZNode(parentZnode, server)
ZKUtil.createAndFailSilent(zkw, node)
end
ensure
@ -103,11 +104,11 @@ def removeServers(_options, hostOrServers)
servers = getServerNames(hostOrServers, config)
zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil)
parentZnode = zkw.znodePaths.drainingZNode
begin
parentZnode = zkw.getZNodePaths.drainingZNode
for server in servers
node = ZKUtil.joinZNode(parentZnode, server)
node = ZNodePaths.joinZNode(parentZnode, server)
ZKUtil.deleteNodeFailSilent(zkw, node)
end
ensure
@ -120,10 +121,14 @@ def listServers(_options)
config = HBaseConfiguration.create
zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil)
parentZnode = zkw.znodePaths.drainingZNode
servers = ZKUtil.listChildrenNoWatch(zkw, parentZnode)
servers.each { |server| puts server }
begin
parentZnode = zkw.getZNodePaths.drainingZNode
servers = ZKUtil.listChildrenNoWatch(zkw, parentZnode)
servers.each { |server| puts server }
ensure
zkw.close
end
end
hostOrServers = ARGV[1..ARGV.size]