HBASE-7540 Make znode dump to print a dump of replciation znodes
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1432235 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d4f7604298
commit
ad853582b4
|
@ -26,6 +26,7 @@ import java.net.InetSocketAddress;
|
|||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.HashMap;
|
||||
|
@ -1253,6 +1254,11 @@ public class ZKUtil {
|
|||
for (String child : listChildrenNoWatch(zkw, zkw.rsZNode)) {
|
||||
sb.append("\n ").append(child);
|
||||
}
|
||||
try {
|
||||
getReplicationZnodesDump(zkw, sb);
|
||||
} catch (KeeperException ke) {
|
||||
LOG.warn("Couldn't get the replication znode dump." + ke.getStackTrace());
|
||||
}
|
||||
sb.append("\nQuorum Server Statistics:");
|
||||
String[] servers = zkw.getQuorum().split(",");
|
||||
for (String server : servers) {
|
||||
|
@ -1279,6 +1285,25 @@ public class ZKUtil {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void getReplicationZnodesDump(ZooKeeperWatcher zkw, StringBuilder sb)
|
||||
throws KeeperException {
|
||||
String replicationZNodeName = zkw.getConfiguration().get("zookeeper.znode.replication",
|
||||
"replication");
|
||||
String replicationZnode = joinZNode(zkw.baseZNode, replicationZNodeName);
|
||||
if (ZKUtil.checkExists(zkw, replicationZnode) == -1) return;
|
||||
// do a ls -r on this znode
|
||||
List<String> stack = new LinkedList<String>();
|
||||
stack.add(replicationZnode);
|
||||
do {
|
||||
String znodeToProcess = stack.remove(stack.size() - 1);
|
||||
sb.append("\n").append(znodeToProcess).append(": ")
|
||||
.append(Bytes.toString(ZKUtil.getData(zkw, znodeToProcess)));
|
||||
for (String zNodeChild : ZKUtil.listChildrenNoWatch(zkw, znodeToProcess)) {
|
||||
stack.add(ZKUtil.joinZNode(znodeToProcess, zNodeChild));
|
||||
}
|
||||
} while (stack.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the statistics from the given server.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue