Repository: hbase Updated Branches: refs/heads/0.98 6dfb25807 -> fa7e0a646
HBASE-12739 Avoid too large identifier of ZooKeeperWatcher (Liu Shaohui) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/fa7e0a64 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/fa7e0a64 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/fa7e0a64 Branch: refs/heads/0.98 Commit: fa7e0a64640d4b4f59449e3b14694caaeb8914df Parents: 6dfb258 Author: stack <[email protected]> Authored: Tue Dec 23 12:20:30 2014 -0800 Committer: stack <[email protected]> Committed: Tue Dec 23 12:31:56 2014 -0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/fa7e0a64/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java index d060b5e..a20f1f6 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java @@ -56,6 +56,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable { // Identifier for this watcher (for logging only). It is made of the prefix // passed on construction and the zookeeper sessionid. + private String prefix; private String identifier; // zookeeper quorum @@ -157,9 +158,10 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable { this.constructorCaller = e; } this.quorum = ZKConfig.getZKQuorumServersString(conf); + this.prefix = identifier; // Identifier will get the sessionid appended later below down when we // handle the syncconnect event. - this.identifier = identifier; + this.identifier = identifier + "0x0"; this.abortable = abortable; setNodeNames(conf); this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, this, identifier); @@ -383,7 +385,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable { this.constructorCaller); throw new NullPointerException("ZK is null"); } - this.identifier = this.identifier + "-0x" + + this.identifier = this.prefix + "-0x" + Long.toHexString(this.recoverableZooKeeper.getSessionId()); // Update our identifier. Otherwise ignore. LOG.debug(this.identifier + " connected");
