HBASE-19761:Fix Checkstyle errors in hbase-zookeeper Signed-off-by: Jan Hentschel <jan.hentsc...@ultratendency.com>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1b98a96c Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1b98a96c Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1b98a96c Branch: refs/heads/HBASE-19064 Commit: 1b98a96caa09ee9be27d6bf028200fe6790ac726 Parents: 9d50048 Author: maoling <maoling199210...@sina.com> Authored: Tue May 29 21:06:38 2018 +0800 Committer: Jan Hentschel <jan.hentsc...@ultratendency.com> Committed: Sat Jun 2 10:08:15 2018 +0200 ---------------------------------------------------------------------- .../hbase/IntegrationTestMetaReplicas.java | 2 +- .../test/IntegrationTestZKAndFSPermissions.java | 4 +- .../replication/ReplicationTrackerZKImpl.java | 7 +- .../replication/ZKReplicationStorageBase.java | 2 +- .../replication/TestReplicationStateZKImpl.java | 5 +- .../hbase/rsgroup/RSGroupInfoManagerImpl.java | 6 +- .../rsgroup/VerifyingRSGroupAdminClient.java | 2 +- .../apache/hadoop/hbase/ZKNamespaceManager.java | 2 +- .../org/apache/hadoop/hbase/ZNodeClearer.java | 2 +- .../backup/example/ZKTableArchiveClient.java | 2 +- .../ZKSplitLogManagerCoordination.java | 12 ++-- .../ZkSplitLogWorkerCoordination.java | 20 +++--- .../hbase/master/ActiveMasterManager.java | 18 ++--- .../hbase/master/DrainingServerTracker.java | 8 +-- .../org/apache/hadoop/hbase/master/HMaster.java | 10 +-- .../hbase/master/MasterMetaBootstrap.java | 4 +- .../hbase/master/RegionServerTracker.java | 12 ++-- .../hadoop/hbase/master/ServerManager.java | 2 +- .../hbase/master/SplitOrMergeTracker.java | 8 +-- .../hbase/master/zksyncer/ClientZKSyncer.java | 2 +- .../master/zksyncer/MasterAddressSyncer.java | 2 +- .../master/zksyncer/MetaLocationSyncer.java | 4 +- .../hadoop/hbase/procedure/ZKProcedureUtil.java | 2 +- .../hbase/regionserver/HRegionServer.java | 2 +- .../replication/HBaseReplicationEndpoint.java | 5 +- .../master/ReplicationPeerConfigUpgrader.java | 2 +- .../security/access/ZKPermissionWatcher.java | 8 +-- .../hbase/security/token/ZKSecretWatcher.java | 2 +- .../visibility/ZKVisibilityLabelWatcher.java | 5 +- .../org/apache/hadoop/hbase/util/HBaseFsck.java | 4 +- .../hadoop/hbase/util/ZKDataMigrator.java | 5 +- .../hbase/client/TestMetaWithReplicas.java | 4 +- .../hbase/master/TestActiveMasterManager.java | 15 ++-- .../hbase/master/TestHMasterRPCException.java | 5 +- .../hbase/master/TestMasterNoCluster.java | 2 +- .../hbase/master/TestMetaShutdownHandler.java | 3 +- .../master/TestMirroringTableStateManager.java | 3 +- .../hbase/master/TestSplitLogManager.java | 14 ++-- .../regionserver/TestMasterAddressTracker.java | 8 ++- .../regionserver/TestRegionServerHostname.java | 4 +- .../hbase/regionserver/TestSplitLogWorker.java | 27 +++---- .../TestReplicationTrackerZKImpl.java | 17 ++--- hbase-zookeeper/pom.xml | 7 ++ .../hbase/zookeeper/ClusterStatusTracker.java | 14 ++-- .../hbase/zookeeper/LoadBalancerTracker.java | 10 +-- .../hbase/zookeeper/MasterAddressTracker.java | 14 ++-- .../zookeeper/MasterMaintenanceModeTracker.java | 5 +- .../hbase/zookeeper/MetaTableLocator.java | 27 +++---- .../hbase/zookeeper/RecoverableZooKeeper.java | 22 +++--- .../zookeeper/RegionNormalizerTracker.java | 8 +-- .../hadoop/hbase/zookeeper/ZKAclReset.java | 4 +- .../hadoop/hbase/zookeeper/ZKClusterId.java | 8 +-- .../hadoop/hbase/zookeeper/ZKMainServer.java | 8 +-- .../hadoop/hbase/zookeeper/ZKNodeTracker.java | 6 +- .../hadoop/hbase/zookeeper/ZKSplitLog.java | 4 +- .../apache/hadoop/hbase/zookeeper/ZKUtil.java | 75 ++++++++++---------- .../hadoop/hbase/zookeeper/ZKWatcher.java | 12 ++-- .../hbase/zookeeper/TestZKLeaderManager.java | 1 - .../hbase/zookeeper/TestZKMainServer.java | 2 +- .../hadoop/hbase/zookeeper/TestZKMulti.java | 40 +++++------ .../hbase/zookeeper/TestZKNodeTracker.java | 6 +- .../hbase/zookeeper/TestZKUtilNoServer.java | 4 +- 62 files changed, 288 insertions(+), 262 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java ---------------------------------------------------------------------- diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java index 37e2686..f14b9a5 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java @@ -81,7 +81,7 @@ public class IntegrationTestMetaReplicas { } private static void waitUntilZnodeAvailable(int replicaId) throws Exception { - String znode = util.getZooKeeperWatcher().znodePaths.getZNodeForReplica(replicaId); + String znode = util.getZooKeeperWatcher().getZNodePaths().getZNodeForReplica(replicaId); int i = 0; while (i < 1000) { if (ZKUtil.checkExists(util.getZooKeeperWatcher(), znode) == -1) { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java ---------------------------------------------------------------------- diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java index 31db2fd..08edd74 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java @@ -144,7 +144,7 @@ public class IntegrationTestZKAndFSPermissions extends AbstractHBaseTool { ZKWatcher watcher = new ZKWatcher(conf, "IntegrationTestZnodeACLs", null); RecoverableZooKeeper zk = ZKUtil.connect(this.conf, watcher); - String baseZNode = watcher.znodePaths.baseZNode; + String baseZNode = watcher.getZNodePaths().baseZNode; LOG.info(""); LOG.info("***********************************************************************************"); @@ -160,7 +160,7 @@ public class IntegrationTestZKAndFSPermissions extends AbstractHBaseTool { private void checkZnodePermsRecursive(ZKWatcher watcher, RecoverableZooKeeper zk, String znode) throws KeeperException, InterruptedException { - boolean expectedWorldReadable = watcher.znodePaths.isClientReadable(znode); + boolean expectedWorldReadable = watcher.getZNodePaths().isClientReadable(znode); assertZnodePerms(zk, znode, expectedWorldReadable); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java ---------------------------------------------------------------------- diff --git a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java index 16a1668..54c9c2c 100644 --- a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java +++ b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java @@ -138,7 +138,7 @@ public class ReplicationTrackerZKImpl implements ReplicationTracker { } private boolean refreshListIfRightPath(String path) { - if (!path.startsWith(this.watcher.znodePaths.rsZNode)) { + if (!path.startsWith(this.watcher.getZNodePaths().rsZNode)) { return false; } return refreshOtherRegionServersList(true); @@ -182,9 +182,10 @@ public class ReplicationTrackerZKImpl implements ReplicationTracker { List<String> result = null; try { if (watch) { - result = ZKUtil.listChildrenAndWatchThem(this.zookeeper, this.zookeeper.znodePaths.rsZNode); + result = ZKUtil.listChildrenAndWatchThem(this.zookeeper, + this.zookeeper.getZNodePaths().rsZNode); } else { - result = ZKUtil.listChildrenNoWatch(this.zookeeper, this.zookeeper.znodePaths.rsZNode); + result = ZKUtil.listChildrenNoWatch(this.zookeeper, this.zookeeper.getZNodePaths().rsZNode); } } catch (KeeperException e) { this.abortable.abort("Get list of registered region servers", e); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java ---------------------------------------------------------------------- diff --git a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java index 7190aeb..d6e692a 100644 --- a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java +++ b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java @@ -50,7 +50,7 @@ public class ZKReplicationStorageBase { this.zookeeper = zookeeper; this.conf = conf; - this.replicationZNode = ZNodePaths.joinZNode(this.zookeeper.znodePaths.baseZNode, + this.replicationZNode = ZNodePaths.joinZNode(this.zookeeper.getZNodePaths().baseZNode, conf.get(REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT)); } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java ---------------------------------------------------------------------- diff --git a/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java b/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java index 08178f4..9eb67f9 100644 --- a/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java +++ b/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java @@ -58,7 +58,7 @@ public class TestReplicationStateZKImpl extends TestReplicationStateBasic { conf.setBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY, true); zkw = utility.getZooKeeperWatcher(); String replicationZNodeName = conf.get("zookeeper.znode.replication", "replication"); - replicationZNode = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, replicationZNodeName); + replicationZNode = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, replicationZNodeName); KEY_ONE = initPeerClusterState("/hbase1"); KEY_TWO = initPeerClusterState("/hbase2"); } @@ -69,7 +69,8 @@ public class TestReplicationStateZKImpl extends TestReplicationStateBasic { Configuration testConf = new Configuration(conf); testConf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, baseZKNode); ZKWatcher zkw1 = new ZKWatcher(testConf, "test1", null); - String fakeRs = ZNodePaths.joinZNode(zkw1.znodePaths.rsZNode, "hostname1.example.org:1234"); + String fakeRs = ZNodePaths.joinZNode(zkw1.getZNodePaths().rsZNode, + "hostname1.example.org:1234"); ZKUtil.createWithParents(zkw1, fakeRs); ZKClusterId.setClusterId(zkw1, new ClusterId()); return ZKConfig.getZooKeeperClusterKey(testConf); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java ---------------------------------------------------------------------- diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java index 6fe7e39..8e70f5e 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java @@ -347,7 +347,7 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager { } List<RSGroupInfo> retrieveGroupListFromZookeeper() throws IOException { - String groupBasePath = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, rsGroupZNode); + String groupBasePath = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, rsGroupZNode); List<RSGroupInfo> RSGroupInfoList = Lists.newArrayList(); //Overwrite any info stored by table, this takes precedence try { @@ -488,7 +488,7 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager { resetRSGroupAndTableMaps(newGroupMap, newTableMap); try { - String groupBasePath = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, rsGroupZNode); + String groupBasePath = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, rsGroupZNode); ZKUtil.createAndFailSilent(watcher, groupBasePath, ProtobufMagic.PB_MAGIC); List<ZKUtil.ZKUtilOp> zkOps = new ArrayList<>(newGroupMap.size()); @@ -549,7 +549,7 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager { LOG.debug("Reading online RS from zookeeper"); List<ServerName> servers = new LinkedList<>(); try { - for (String el: ZKUtil.listChildrenNoWatch(watcher, watcher.znodePaths.rsZNode)) { + for (String el: ZKUtil.listChildrenNoWatch(watcher, watcher.getZNodePaths().rsZNode)) { servers.add(ServerName.parseServerName(el)); } } catch (KeeperException e) { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java ---------------------------------------------------------------------- diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java index 7c13fc3..88a4339 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java @@ -134,7 +134,7 @@ public class VerifyingRSGroupAdminClient implements RSGroupAdmin { Assert.assertEquals(Sets.newHashSet(groupMap.values()), Sets.newHashSet(wrapped.listRSGroups())); try { - String groupBasePath = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "rsgroup"); + String groupBasePath = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "rsgroup"); for(String znode: ZKUtil.listChildrenNoWatch(zkw, groupBasePath)) { byte[] data = ZKUtil.getData(zkw, ZNodePaths.joinZNode(groupBasePath, znode)); if(data.length > 0) { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java index 53b2439..101c40e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java @@ -55,7 +55,7 @@ public class ZKNamespaceManager extends ZKListener { public ZKNamespaceManager(ZKWatcher zkw) throws IOException { super(zkw); - nsZNode = zkw.znodePaths.namespaceZNode; + nsZNode = zkw.getZNodePaths().namespaceZNode; cache = new ConcurrentSkipListMap<>(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java index f0b3a41..6977065 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java @@ -186,7 +186,7 @@ public final class ZNodeClearer { if (ZNodeClearer.tablesOnMaster(conf)) { // In case of master crash also remove rsZnode since master is also regionserver ZKUtil.deleteNodeFailSilent(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, znodeFileContent)); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, znodeFileContent)); return MasterAddressTracker.deleteIfEquals(zkw, ZNodeClearer.parseMasterServerName(znodeFileContent)); } else { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java index 39d9543..142788e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java @@ -149,7 +149,7 @@ public class ZKTableArchiveClient extends Configured { * @return get the znode for long-term archival of a table for */ public static String getArchiveZNode(Configuration conf, ZKWatcher zooKeeper) { - return ZNodePaths.joinZNode(zooKeeper.znodePaths.baseZNode, conf.get( + return ZNodePaths.joinZNode(zooKeeper.getZNodePaths().baseZNode, conf.get( ZOOKEEPER_ZNODE_HFILE_ARCHIVE_KEY, TableHFileArchiveTracker.HFILE_ARCHIVE_ZNODE_PARENT)); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java index 409cd26..c1fbac9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java @@ -122,7 +122,8 @@ public class ZKSplitLogManagerCoordination extends ZKListener implements public int remainingTasksInCoordination() { int count = 0; try { - List<String> tasks = ZKUtil.listChildrenNoWatch(watcher, watcher.znodePaths.splitLogZNode); + List<String> tasks = ZKUtil.listChildrenNoWatch(watcher, + watcher.getZNodePaths().splitLogZNode); if (tasks != null) { int listSize = tasks.size(); for (int i = 0; i < listSize; i++) { @@ -466,13 +467,14 @@ public class ZKSplitLogManagerCoordination extends ZKListener implements private void lookForOrphans() { List<String> orphans; try { - orphans = ZKUtil.listChildrenNoWatch(this.watcher, this.watcher.znodePaths.splitLogZNode); + orphans = ZKUtil.listChildrenNoWatch(this.watcher, + this.watcher.getZNodePaths().splitLogZNode); if (orphans == null) { - LOG.warn("Could not get children of " + this.watcher.znodePaths.splitLogZNode); + LOG.warn("Could not get children of " + this.watcher.getZNodePaths().splitLogZNode); return; } } catch (KeeperException e) { - LOG.warn("Could not get children of " + this.watcher.znodePaths.splitLogZNode + " " + LOG.warn("Could not get children of " + this.watcher.getZNodePaths().splitLogZNode + " " + StringUtils.stringifyException(e)); return; } @@ -480,7 +482,7 @@ public class ZKSplitLogManagerCoordination extends ZKListener implements int listSize = orphans.size(); for (int i = 0; i < listSize; i++) { String path = orphans.get(i); - String nodepath = ZNodePaths.joinZNode(watcher.znodePaths.splitLogZNode, path); + String nodepath = ZNodePaths.joinZNode(watcher.getZNodePaths().splitLogZNode, path); if (ZKSplitLog.isRescanNode(watcher, nodepath)) { rescan_nodes++; LOG.debug("Found orphan rescan node " + path); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java index 2143f80..ff555f2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java @@ -97,7 +97,7 @@ public class ZkSplitLogWorkerCoordination extends ZKListener implements */ @Override public void nodeChildrenChanged(String path) { - if (path.equals(watcher.znodePaths.splitLogZNode)) { + if (path.equals(watcher.getZNodePaths().splitLogZNode)) { if (LOG.isTraceEnabled()) { LOG.trace("tasks arrived or departed on " + path); } @@ -331,7 +331,7 @@ public class ZkSplitLogWorkerCoordination extends ZKListener implements int availableRSs = 1; try { List<String> regionServers = - ZKUtil.listChildrenNoWatch(watcher, watcher.znodePaths.rsZNode); + ZKUtil.listChildrenNoWatch(watcher, watcher.getZNodePaths().rsZNode); availableRSs = Math.max(availableRSs, (regionServers == null) ? 0 : regionServers.size()); } catch (KeeperException e) { // do nothing @@ -412,7 +412,7 @@ public class ZkSplitLogWorkerCoordination extends ZKListener implements List<String> paths; paths = getTaskList(); if (paths == null) { - LOG.warn("Could not get tasks, did someone remove " + watcher.znodePaths.splitLogZNode + LOG.warn("Could not get tasks, did someone remove " + watcher.getZNodePaths().splitLogZNode + " ... worker thread exiting."); return; } @@ -439,7 +439,7 @@ public class ZkSplitLogWorkerCoordination extends ZKListener implements // don't call ZKSplitLog.getNodeName() because that will lead to // double encoding of the path name taskGrabbed |= grabTask(ZNodePaths.joinZNode( - watcher.znodePaths.splitLogZNode, paths.get(idx))); + watcher.getZNodePaths().splitLogZNode, paths.get(idx))); break; } else { LOG.debug("Current region server " + server.getServerName() + " has " @@ -472,14 +472,14 @@ public class ZkSplitLogWorkerCoordination extends ZKListener implements while (!shouldStop) { try { childrenPaths = ZKUtil.listChildrenAndWatchForNewChildren(watcher, - watcher.znodePaths.splitLogZNode); + watcher.getZNodePaths().splitLogZNode); if (childrenPaths != null) { return childrenPaths; } } catch (KeeperException e) { - LOG.warn("Could not get children of znode " + watcher.znodePaths.splitLogZNode, e); + LOG.warn("Could not get children of znode " + watcher.getZNodePaths().splitLogZNode, e); } - LOG.debug("Retry listChildren of znode " + watcher.znodePaths.splitLogZNode + LOG.debug("Retry listChildren of znode " + watcher.getZNodePaths().splitLogZNode + " after sleep for " + sleepTime + "ms!"); Thread.sleep(sleepTime); } @@ -495,14 +495,14 @@ public class ZkSplitLogWorkerCoordination extends ZKListener implements public boolean isReady() throws InterruptedException { int result = -1; try { - result = ZKUtil.checkExists(watcher, watcher.znodePaths.splitLogZNode); + result = ZKUtil.checkExists(watcher, watcher.getZNodePaths().splitLogZNode); } catch (KeeperException e) { // ignore - LOG.warn("Exception when checking for " + watcher.znodePaths.splitLogZNode + LOG.warn("Exception when checking for " + watcher.getZNodePaths().splitLogZNode + " ... retrying", e); } if (result == -1) { - LOG.info(watcher.znodePaths.splitLogZNode + LOG.info(watcher.getZNodePaths().splitLogZNode + " znode does not exist, waiting for master to create"); Thread.sleep(1000); } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java index 78cb024..50798ed 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java @@ -93,7 +93,7 @@ public class ActiveMasterManager extends ZKListener { // shut down, so that state is now irrelevant. This means that the shutdown // state must be set while we wait on the active master in order // to shutdown this master. See HBASE-8519. - if(path.equals(watcher.znodePaths.clusterStateZNode) && !master.isStopped()) { + if(path.equals(watcher.getZNodePaths().clusterStateZNode) && !master.isStopped()) { clusterShutDown.set(true); } @@ -101,7 +101,7 @@ public class ActiveMasterManager extends ZKListener { } void handle(final String path) { - if (path.equals(watcher.znodePaths.masterAddressZNode) && !master.isStopped()) { + if (path.equals(watcher.getZNodePaths().masterAddressZNode) && !master.isStopped()) { handleMasterNodeChange(); } } @@ -123,7 +123,7 @@ public class ActiveMasterManager extends ZKListener { // Watch the node and check if it exists. try { synchronized(clusterHasActiveMaster) { - if (ZKUtil.watchAndCheckExists(watcher, watcher.znodePaths.masterAddressZNode)) { + if (ZKUtil.watchAndCheckExists(watcher, watcher.getZNodePaths().masterAddressZNode)) { // A master node exists, there is an active master LOG.trace("A master is now available"); clusterHasActiveMaster.set(true); @@ -157,14 +157,14 @@ public class ActiveMasterManager extends ZKListener { boolean blockUntilBecomingActiveMaster( int checkInterval, MonitoredTask startupStatus) { String backupZNode = ZNodePaths.joinZNode( - this.watcher.znodePaths.backupMasterAddressesZNode, this.sn.toString()); + this.watcher.getZNodePaths().backupMasterAddressesZNode, this.sn.toString()); while (!(master.isAborted() || master.isStopped())) { startupStatus.setStatus("Trying to register in ZK as active master"); // Try to become the active master, watch if there is another master. // Write out our ServerName as versioned bytes. try { if (MasterAddressTracker.setMasterAddress(this.watcher, - this.watcher.znodePaths.masterAddressZNode, this.sn, infoPort)) { + this.watcher.getZNodePaths().masterAddressZNode, this.sn, infoPort)) { // If we were a backup master before, delete our ZNode from the backup // master directory since we are the active now) @@ -188,7 +188,7 @@ public class ActiveMasterManager extends ZKListener { String msg; byte[] bytes = - ZKUtil.getDataAndWatch(this.watcher, this.watcher.znodePaths.masterAddressZNode); + ZKUtil.getDataAndWatch(this.watcher, this.watcher.getZNodePaths().masterAddressZNode); if (bytes == null) { msg = ("A master was detected, but went down before its address " + "could be read. Attempting to become the next active master"); @@ -205,7 +205,7 @@ public class ActiveMasterManager extends ZKListener { msg = ("Current master has this master's address, " + currentMaster + "; master was restarted? Deleting node."); // Hurry along the expiration of the znode. - ZKUtil.deleteNode(this.watcher, this.watcher.znodePaths.masterAddressZNode); + ZKUtil.deleteNode(this.watcher, this.watcher.getZNodePaths().masterAddressZNode); // We may have failed to delete the znode at the previous step, but // we delete the file anyway: a second attempt to delete the znode is likely to fail again. @@ -245,7 +245,7 @@ public class ActiveMasterManager extends ZKListener { */ boolean hasActiveMaster() { try { - if (ZKUtil.checkExists(watcher, watcher.znodePaths.masterAddressZNode) >= 0) { + if (ZKUtil.checkExists(watcher, watcher.getZNodePaths().masterAddressZNode) >= 0) { return true; } } @@ -271,7 +271,7 @@ public class ActiveMasterManager extends ZKListener { LOG.warn("Failed get of master address: " + e.toString()); } if (activeMaster != null && activeMaster.equals(this.sn)) { - ZKUtil.deleteNode(watcher, watcher.znodePaths.masterAddressZNode); + ZKUtil.deleteNode(watcher, watcher.getZNodePaths().masterAddressZNode); // We may have failed to delete the znode at the previous step, but // we delete the file anyway: a second attempt to delete the znode is likely to fail again. ZNodeClearer.deleteMyEphemeralNodeOnDisk(); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java index a9e5796..14c4a3e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java @@ -83,7 +83,7 @@ public class DrainingServerTracker extends ZKListener { } }); List<String> servers = - ZKUtil.listChildrenAndWatchThem(watcher, watcher.znodePaths.drainingZNode); + ZKUtil.listChildrenAndWatchThem(watcher, watcher.getZNodePaths().drainingZNode); add(servers); } @@ -110,7 +110,7 @@ public class DrainingServerTracker extends ZKListener { @Override public void nodeDeleted(final String path) { - if(path.startsWith(watcher.znodePaths.drainingZNode)) { + if(path.startsWith(watcher.getZNodePaths().drainingZNode)) { final ServerName sn = ServerName.valueOf(ZKUtil.getNodeName(path)); LOG.info("Draining RS node deleted, removing from list [" + sn + "]"); @@ -120,10 +120,10 @@ public class DrainingServerTracker extends ZKListener { @Override public void nodeChildrenChanged(final String path) { - if(path.equals(watcher.znodePaths.drainingZNode)) { + if(path.equals(watcher.getZNodePaths().drainingZNode)) { try { final List<String> newNodes = - ZKUtil.listChildrenAndWatchThem(watcher, watcher.znodePaths.drainingZNode); + ZKUtil.listChildrenAndWatchThem(watcher, watcher.getZNodePaths().drainingZNode); add(newNodes); } catch (KeeperException e) { abortable.abort("Unexpected zk exception getting RS nodes", e); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 68b3ce8..b565963 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -2025,7 +2025,7 @@ public class HMaster extends HRegionServer implements MasterServices { private void startActiveMasterManager(int infoPort) throws KeeperException { String backupZNode = ZNodePaths.joinZNode( - zooKeeper.znodePaths.backupMasterAddressesZNode, serverName.toString()); + zooKeeper.getZNodePaths().backupMasterAddressesZNode, serverName.toString()); /* * Add a ZNode for ourselves in the backup master directory since we * may not become the active master. If so, we want the actual active @@ -2538,7 +2538,7 @@ public class HMaster extends HRegionServer implements MasterServices { List<String> backupMasterStrings; try { backupMasterStrings = ZKUtil.listChildrenNoWatch(this.zooKeeper, - this.zooKeeper.znodePaths.backupMasterAddressesZNode); + this.zooKeeper.getZNodePaths().backupMasterAddressesZNode); } catch (KeeperException e) { LOG.warn(this.zooKeeper.prefix("Unable to list backup servers"), e); backupMasterStrings = null; @@ -2552,7 +2552,7 @@ public class HMaster extends HRegionServer implements MasterServices { byte [] bytes; try { bytes = ZKUtil.getData(this.zooKeeper, ZNodePaths.joinZNode( - this.zooKeeper.znodePaths.backupMasterAddressesZNode, s)); + this.zooKeeper.getZNodePaths().backupMasterAddressesZNode, s)); } catch (InterruptedException e) { throw new InterruptedIOException(); } @@ -3500,7 +3500,7 @@ public class HMaster extends HRegionServer implements MasterServices { throws HBaseIOException { List<ServerName> serversAdded = new ArrayList<>(servers.size()); // Place the decommission marker first. - String parentZnode = getZooKeeper().znodePaths.drainingZNode; + String parentZnode = getZooKeeper().getZNodePaths().drainingZNode; for (ServerName server : servers) { try { String node = ZNodePaths.joinZNode(parentZnode, server.getServerName()); @@ -3549,7 +3549,7 @@ public class HMaster extends HRegionServer implements MasterServices { public void recommissionRegionServer(final ServerName server, final List<byte[]> encodedRegionNames) throws HBaseIOException { // Remove the server from decommissioned (draining) server list. - String parentZnode = getZooKeeper().znodePaths.drainingZNode; + String parentZnode = getZooKeeper().getZNodePaths().drainingZNode; String node = ZNodePaths.joinZNode(parentZnode, server.getServerName()); try { ZKUtil.deleteNodeFailSilent(getZooKeeper(), node); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java index eab937d..59f1233 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java @@ -125,14 +125,14 @@ public class MasterMetaBootstrap { try { List<String> metaReplicaZnodes = zooKeeper.getMetaReplicaNodes(); for (String metaReplicaZnode : metaReplicaZnodes) { - int replicaId = zooKeeper.znodePaths.getMetaReplicaIdFromZnode(metaReplicaZnode); + int replicaId = zooKeeper.getZNodePaths().getMetaReplicaIdFromZnode(metaReplicaZnode); if (replicaId >= numMetaReplicasConfigured) { RegionState r = MetaTableLocator.getMetaRegionState(zooKeeper, replicaId); LOG.info("Closing excess replica of meta region " + r.getRegion()); // send a close and wait for a max of 30 seconds ServerManager.closeRegionSilentlyAndWait(master.getClusterConnection(), r.getServerName(), r.getRegion(), 30000); - ZKUtil.deleteNode(zooKeeper, zooKeeper.znodePaths.getZNodeForReplica(replicaId)); + ZKUtil.deleteNode(zooKeeper, zooKeeper.getZNodePaths().getZNodeForReplica(replicaId)); } } } catch (Exception ex) { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java index 81fc589..100476b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java @@ -72,7 +72,7 @@ public class RegionServerTracker extends ZKListener { public void start() throws KeeperException, IOException { watcher.registerListener(this); List<String> servers = - ZKUtil.listChildrenAndWatchThem(watcher, watcher.znodePaths.rsZNode); + ZKUtil.listChildrenAndWatchThem(watcher, watcher.getZNodePaths().rsZNode); refresh(servers); } @@ -84,7 +84,7 @@ public class RegionServerTracker extends ZKListener { if (regionServers.get(sn) == null) { RegionServerInfo.Builder rsInfoBuilder = RegionServerInfo.newBuilder(); try { - String nodePath = ZNodePaths.joinZNode(watcher.znodePaths.rsZNode, n); + String nodePath = ZNodePaths.joinZNode(watcher.getZNodePaths().rsZNode, n); byte[] data = ZKUtil.getData(watcher, nodePath); if (data != null && data.length > 0 && ProtobufUtil.isPBMagicPrefix(data)) { int magicLen = ProtobufUtil.lengthOfPBMagic(); @@ -114,7 +114,7 @@ public class RegionServerTracker extends ZKListener { @Override public void nodeCreated(String path) { - if (path.startsWith(watcher.znodePaths.rsZNode)) { + if (path.startsWith(watcher.getZNodePaths().rsZNode)) { String serverName = ZKUtil.getNodeName(path); LOG.info("RegionServer ephemeral node created, adding [" + serverName + "]"); if (server.isInitialized()) { @@ -127,7 +127,7 @@ public class RegionServerTracker extends ZKListener { @Override public void nodeDeleted(String path) { - if (path.startsWith(watcher.znodePaths.rsZNode)) { + if (path.startsWith(watcher.getZNodePaths().rsZNode)) { String serverName = ZKUtil.getNodeName(path); LOG.info("RegionServer ephemeral node deleted, processing expiration [" + serverName + "]"); @@ -144,11 +144,11 @@ public class RegionServerTracker extends ZKListener { @Override public void nodeChildrenChanged(String path) { - if (path.equals(watcher.znodePaths.rsZNode) + if (path.equals(watcher.getZNodePaths().rsZNode) && !server.isAborted() && !server.isStopped()) { try { List<String> servers = - ZKUtil.listChildrenAndWatchThem(watcher, watcher.znodePaths.rsZNode); + ZKUtil.listChildrenAndWatchThem(watcher, watcher.getZNodePaths().rsZNode); refresh(servers); } catch (IOException e) { server.abort("Unexpected zk exception getting RS nodes", e); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java index a65d95f..4b07244 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java @@ -551,7 +551,7 @@ public class ServerManager { private List<String> getRegionServersInZK(final ZKWatcher zkw) throws KeeperException { - return ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.rsZNode); + return ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().rsZNode); } /* http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java index 52040fa..a18738f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java @@ -49,15 +49,15 @@ public class SplitOrMergeTracker { public SplitOrMergeTracker(ZKWatcher watcher, Configuration conf, Abortable abortable) { try { - if (ZKUtil.checkExists(watcher, watcher.znodePaths.switchZNode) < 0) { - ZKUtil.createAndFailSilent(watcher, watcher.znodePaths.switchZNode); + if (ZKUtil.checkExists(watcher, watcher.getZNodePaths().switchZNode) < 0) { + ZKUtil.createAndFailSilent(watcher, watcher.getZNodePaths().switchZNode); } } catch (KeeperException e) { throw new RuntimeException(e); } - splitZnode = ZNodePaths.joinZNode(watcher.znodePaths.switchZNode, + splitZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().switchZNode, conf.get("zookeeper.znode.switch.split", "split")); - mergeZnode = ZNodePaths.joinZNode(watcher.znodePaths.switchZNode, + mergeZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().switchZNode, conf.get("zookeeper.znode.switch.merge", "merge")); splitStateTracker = new SwitchStateTracker(watcher, splitZnode, abortable); mergeStateTracker = new SwitchStateTracker(watcher, mergeZnode, abortable); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java index 550aea7..b1c70c5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java @@ -68,7 +68,7 @@ public abstract class ClientZKSyncer extends ZKListener { LOG.debug("Starting " + getClass().getSimpleName()); this.watcher.registerListener(this); // create base znode on remote ZK - ZKUtil.createWithParents(clientZkWatcher, watcher.znodePaths.baseZNode); + ZKUtil.createWithParents(clientZkWatcher, watcher.getZNodePaths().baseZNode); // set meta znodes for client ZK Collection<String> nodes = getNodesToWatch(); LOG.debug("Znodes to watch: " + nodes); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java index 3da8558..a9aa13c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java @@ -35,7 +35,7 @@ public class MasterAddressSyncer extends ClientZKSyncer { public MasterAddressSyncer(ZKWatcher watcher, ZKWatcher clientZkWatcher, Server server) { super(watcher, clientZkWatcher, server); - masterAddressZNode = watcher.znodePaths.masterAddressZNode; + masterAddressZNode = watcher.getZNodePaths().masterAddressZNode; } @Override http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java index 68f7fc4..eb80a2a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java @@ -36,11 +36,11 @@ public class MetaLocationSyncer extends ClientZKSyncer { @Override boolean validate(String path) { - return watcher.znodePaths.isAnyMetaReplicaZNode(path); + return watcher.getZNodePaths().isAnyMetaReplicaZNode(path); } @Override Collection<String> getNodesToWatch() { - return watcher.znodePaths.metaReplicaZNodes.values(); + return watcher.getZNodePaths().metaReplicaZNodes.values(); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java index 210bc02..0e97999 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java @@ -79,7 +79,7 @@ public abstract class ZKProcedureUtil // make sure we are listening for events watcher.registerListener(this); // setup paths for the zknodes used in procedures - this.baseZNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, procDescription); + this.baseZNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, procDescription); acquiredZnode = ZNodePaths.joinZNode(baseZNode, ACQUIRED_BARRIER_ZNODE_DEFAULT); reachedZnode = ZNodePaths.joinZNode(baseZNode, REACHED_BARRIER_ZNODE_DEFAULT); abortZnode = ZNodePaths.joinZNode(baseZNode, ABORT_ZNODE_DEFAULT); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index a17b402..db7052e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -3507,7 +3507,7 @@ public class HRegionServer extends HasThread implements } private String getMyEphemeralNodePath() { - return ZNodePaths.joinZNode(this.zooKeeper.znodePaths.rsZNode, getServerName().toString()); + return ZNodePaths.joinZNode(this.zooKeeper.getZNodePaths().rsZNode, getServerName().toString()); } private boolean isHealthCheckerConfigured() { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java index 9cb3312..1ca70ad 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java @@ -155,7 +155,8 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint */ protected static List<ServerName> fetchSlavesAddresses(ZKWatcher zkw) throws KeeperException { - List<String> children = ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.znodePaths.rsZNode); + List<String> children = ZKUtil.listChildrenAndWatchForNewChildren(zkw, + zkw.getZNodePaths().rsZNode); if (children == null) { return Collections.emptyList(); } @@ -216,7 +217,7 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint public PeerRegionServerListener(HBaseReplicationEndpoint replicationPeer) { super(replicationPeer.getZkw()); this.replicationEndpoint = replicationPeer; - this.regionServerListNode = replicationEndpoint.getZkw().znodePaths.rsZNode; + this.regionServerListNode = replicationEndpoint.getZkw().getZNodePaths().rsZNode; } @Override http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java index ac1acbe..4d48123 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java @@ -97,7 +97,7 @@ public class ReplicationPeerConfigUpgrader{ @VisibleForTesting protected String getTableCFsNode(String peerId) { - String replicationZNode = ZNodePaths.joinZNode(zookeeper.znodePaths.baseZNode, + String replicationZNode = ZNodePaths.joinZNode(zookeeper.getZNodePaths().baseZNode, conf.get(REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT)); String peersZNode = ZNodePaths.joinZNode(replicationZNode, conf.get(PEERS_ZNODE, PEERS_ZNODE_DEFAULT)); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java index 92560cd..2266e86 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java @@ -67,7 +67,7 @@ public class ZKPermissionWatcher extends ZKListener implements Closeable { super(watcher); this.authManager = authManager; String aclZnodeParent = conf.get("zookeeper.znode.acl.parent", ACL_NODE); - this.aclZNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, aclZnodeParent); + this.aclZNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, aclZnodeParent); executor = Executors.newSingleThreadExecutor( new DaemonThreadFactory("zk-permission-watcher")); } @@ -260,7 +260,7 @@ public class ZKPermissionWatcher extends ZKListener implements Closeable { */ public void writeToZookeeper(byte[] entry, byte[] permsData) { String entryName = Bytes.toString(entry); - String zkNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, ACL_NODE); + String zkNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, ACL_NODE); zkNode = ZNodePaths.joinZNode(zkNode, entryName); try { @@ -278,7 +278,7 @@ public class ZKPermissionWatcher extends ZKListener implements Closeable { * @param tableName */ public void deleteTableACLNode(final TableName tableName) { - String zkNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, ACL_NODE); + String zkNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, ACL_NODE); zkNode = ZNodePaths.joinZNode(zkNode, tableName.getNameAsString()); try { @@ -295,7 +295,7 @@ public class ZKPermissionWatcher extends ZKListener implements Closeable { * Delete the acl notify node of namespace */ public void deleteNamespaceACLNode(final String namespace) { - String zkNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, ACL_NODE); + String zkNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, ACL_NODE); zkNode = ZNodePaths.joinZNode(zkNode, AccessControlLists.NAMESPACE_PREFIX + namespace); try { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java index d86a2f9..f7be45b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java @@ -54,7 +54,7 @@ public class ZKSecretWatcher extends ZKListener { super(watcher); this.secretManager = secretManager; String keyZNodeParent = conf.get("zookeeper.znode.tokenauth.parent", DEFAULT_ROOT_NODE); - this.baseKeyZNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, keyZNodeParent); + this.baseKeyZNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, keyZNodeParent); this.keysParentZNode = ZNodePaths.joinZNode(baseKeyZNode, DEFAULT_KEYS_PARENT); } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java index d428ff4..0bbc8d3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java @@ -54,8 +54,9 @@ public class ZKVisibilityLabelWatcher extends ZKListener { String labelZnodeParent = conf.get(VISIBILITY_LABEL_ZK_PATH, DEFAULT_VISIBILITY_LABEL_NODE); String userAuthsZnodeParent = conf.get(VISIBILITY_USER_AUTHS_ZK_PATH, DEFAULT_VISIBILITY_USER_AUTHS_NODE); - this.labelZnode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, labelZnodeParent); - this.userAuthsZnode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, userAuthsZnodeParent); + this.labelZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, labelZnodeParent); + this.userAuthsZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, + userAuthsZnodeParent); } public void start() throws KeeperException { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java index 035ebd6..820a4e0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java @@ -722,7 +722,7 @@ public class HBaseFsck extends Configured implements Closeable { private boolean setMasterInMaintenanceMode() throws IOException { RetryCounter retryCounter = createZNodeRetryCounterFactory.create(); hbckEphemeralNodePath = ZNodePaths.joinZNode( - zkw.znodePaths.masterMaintZNode, + zkw.getZNodePaths().masterMaintZNode, "hbck-" + Long.toString(EnvironmentEdgeManager.currentTime())); do { try { @@ -3672,7 +3672,7 @@ public class HBaseFsck extends Configured implements Closeable { private void unassignMetaReplica(HbckInfo hi) throws IOException, InterruptedException, KeeperException { undeployRegions(hi); - ZKUtil.deleteNode(zkw, zkw.znodePaths.getZNodeForReplica(hi.metaEntry.getReplicaId())); + ZKUtil.deleteNode(zkw, zkw.getZNodePaths().getZNodeForReplica(hi.metaEntry.getReplicaId())); } private void assignMetaReplica(int replicaId) http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java index 129341c..6b284ad 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java @@ -60,7 +60,7 @@ public class ZKDataMigrator { public static Map<TableName, TableState.State> queryForTableStates(ZKWatcher zkw) throws KeeperException, InterruptedException { Map<TableName, TableState.State> rv = new HashMap<>(); - List<String> children = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.tableZNode); + List<String> children = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().tableZNode); if (children == null) return rv; for (String child: children) { @@ -101,7 +101,8 @@ public class ZKDataMigrator { private static ZooKeeperProtos.DeprecatedTableState.State getTableState( final ZKWatcher zkw, final TableName tableName) throws KeeperException, InterruptedException { - String znode = ZNodePaths.joinZNode(zkw.znodePaths.tableZNode, tableName.getNameAsString()); + String znode = ZNodePaths.joinZNode(zkw.getZNodePaths().tableZNode, + tableName.getNameAsString()); byte [] data = ZKUtil.getData(zkw, znode); if (data == null || data.length <= 0) return null; try { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java index 2da9886..330fe75 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java @@ -179,7 +179,7 @@ public class TestMetaWithReplicas { for (int i = 1; i < 3; i++) { String secZnode = ZNodePaths.joinZNode(baseZNode, conf.get("zookeeper.znode.metaserver", "meta-region-server") + "-" + i); - String str = zkw.znodePaths.getZNodeForReplica(i); + String str = zkw.getZNodePaths().getZNodeForReplica(i); assertTrue(str.equals(secZnode)); // check that the data in the znode is parseable (this would also mean the znode exists) data = ZKUtil.getData(zkw, secZnode); @@ -413,7 +413,7 @@ public class TestMetaWithReplicas { HBaseFsckRepair.closeRegionSilentlyAndWait(c, rl.getRegionLocation(2).getServerName(), rl.getRegionLocation(2).getRegionInfo()); ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher(); - ZKUtil.deleteNode(zkw, zkw.znodePaths.getZNodeForReplica(2)); + ZKUtil.deleteNode(zkw, zkw.getZNodePaths().getZNodeForReplica(2)); // check that problem exists HBaseFsck hbck = doFsck(TEST_UTIL.getConfiguration(), false); assertErrors(hbck, new ERROR_CODE[]{ERROR_CODE.UNKNOWN,ERROR_CODE.NO_META_REGION}); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java index 9f68ea5..5851dea 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java @@ -79,8 +79,8 @@ public class TestActiveMasterManager { ZKWatcher zk = new ZKWatcher(TEST_UTIL.getConfiguration(), "testActiveMasterManagerFromZK", null, true); try { - ZKUtil.deleteNode(zk, zk.znodePaths.masterAddressZNode); - ZKUtil.deleteNode(zk, zk.znodePaths.clusterStateZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().masterAddressZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().clusterStateZNode); } catch(KeeperException.NoNodeException nne) {} // Create the master node with a dummy address @@ -121,8 +121,8 @@ public class TestActiveMasterManager { ZKWatcher zk = new ZKWatcher(TEST_UTIL.getConfiguration(), "testActiveMasterManagerFromZK", null, true); try { - ZKUtil.deleteNode(zk, zk.znodePaths.masterAddressZNode); - ZKUtil.deleteNode(zk, zk.znodePaths.clusterStateZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().masterAddressZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().clusterStateZNode); } catch(KeeperException.NoNodeException nne) {} // Create the master node with a dummy address @@ -167,11 +167,12 @@ public class TestActiveMasterManager { ms1.stop("stopping first server"); // Use a listener to capture when the node is actually deleted - NodeDeletionListener listener = new NodeDeletionListener(zk, zk.znodePaths.masterAddressZNode); + NodeDeletionListener listener = new NodeDeletionListener(zk, + zk.getZNodePaths().masterAddressZNode); zk.registerListener(listener); LOG.info("Deleting master node"); - ZKUtil.deleteNode(zk, zk.znodePaths.masterAddressZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().masterAddressZNode); // Wait for the node to be deleted LOG.info("Waiting for active master manager to be notified"); @@ -191,7 +192,7 @@ public class TestActiveMasterManager { assertTrue(t.isActiveMaster); LOG.info("Deleting master node"); - ZKUtil.deleteNode(zk, zk.znodePaths.masterAddressZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().masterAddressZNode); } /** http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java index 8630dbb..1970737 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java @@ -72,7 +72,8 @@ public class TestHMasterRPCException { testUtil.startMiniZKCluster(); ZKWatcher watcher = testUtil.getZooKeeperWatcher(); - ZKUtil.createWithParents(watcher, watcher.znodePaths.masterAddressZNode, Bytes.toBytes("fake:123")); + ZKUtil.createWithParents(watcher, watcher.getZNodePaths().masterAddressZNode, + Bytes.toBytes("fake:123")); master = new HMaster(conf); rpcClient = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT); } @@ -109,7 +110,7 @@ public class TestHMasterRPCException { LOG.info("Expected exception: ", ie); if (!fakeZNodeDelete) { testUtil.getZooKeeperWatcher().getRecoverableZooKeeper() - .delete(testUtil.getZooKeeperWatcher().znodePaths.masterAddressZNode, -1); + .delete(testUtil.getZooKeeperWatcher().getZNodePaths().masterAddressZNode, -1); fakeZNodeDelete = true; } } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java index 87e45c5..95ab229 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java @@ -120,7 +120,7 @@ public class TestMasterNoCluster { return false; } }); - ZKUtil.deleteNodeRecursively(zkw, zkw.znodePaths.baseZNode); + ZKUtil.deleteNodeRecursively(zkw, zkw.getZNodePaths().baseZNode); zkw.close(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java index 7faed1c..9497210 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java @@ -102,7 +102,8 @@ public class TestMetaShutdownHandler { // Delete the ephemeral node of the meta-carrying region server. // This is trigger the expire of this region server on the master. String rsEphemeralNodePath = - ZNodePaths.joinZNode(master.getZooKeeper().znodePaths.rsZNode, metaServerName.toString()); + ZNodePaths.joinZNode(master.getZooKeeper().getZNodePaths().rsZNode, + metaServerName.toString()); ZKUtil.deleteNode(master.getZooKeeper(), rsEphemeralNodePath); LOG.info("Deleted the znode for the RegionServer hosting hbase:meta; waiting on SSH"); // Wait for SSH to finish http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java index d10c2b4..f1ebc17 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java @@ -82,7 +82,8 @@ public class TestMirroringTableStateManager { private TableState.State getTableStateInZK(ZKWatcher watcher, final TableName tableName) throws KeeperException, IOException, InterruptedException { - String znode = ZNodePaths.joinZNode(watcher.znodePaths.tableZNode, tableName.getNameAsString()); + String znode = ZNodePaths.joinZNode(watcher.getZNodePaths().tableZNode, + tableName.getNameAsString()); byte [] data = ZKUtil.getData(watcher, znode); if (data == null || data.length <= 0) { return null; http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java index 533f4dc..c611bed 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java @@ -127,13 +127,13 @@ public class TestSplitLogManager { new ZKWatcher(conf, "split-log-manager-tests" + UUID.randomUUID().toString(), null); master = new DummyMasterServices(zkw, conf); - ZKUtil.deleteChildrenRecursively(zkw, zkw.znodePaths.baseZNode); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.baseZNode); - assertTrue(ZKUtil.checkExists(zkw, zkw.znodePaths.baseZNode) != -1); - LOG.debug(zkw.znodePaths.baseZNode + " created"); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.splitLogZNode); - assertTrue(ZKUtil.checkExists(zkw, zkw.znodePaths.splitLogZNode) != -1); - LOG.debug(zkw.znodePaths.splitLogZNode + " created"); + ZKUtil.deleteChildrenRecursively(zkw, zkw.getZNodePaths().baseZNode); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().baseZNode); + assertTrue(ZKUtil.checkExists(zkw, zkw.getZNodePaths().baseZNode) != -1); + LOG.debug(zkw.getZNodePaths().baseZNode + " created"); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().splitLogZNode); + assertTrue(ZKUtil.checkExists(zkw, zkw.getZNodePaths().splitLogZNode) != -1); + LOG.debug(zkw.getZNodePaths().splitLogZNode + " created"); resetCounters(); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java index 2a89b99..58b4e72 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java @@ -87,7 +87,7 @@ public class TestMasterAddressTracker { throws Exception { ZKWatcher zk = new ZKWatcher(TEST_UTIL.getConfiguration(), name.getMethodName(), null); - ZKUtil.createAndFailSilent(zk, zk.znodePaths.baseZNode); + ZKUtil.createAndFailSilent(zk, zk.getZNodePaths().baseZNode); // Should not have a master yet MasterAddressTracker addressTracker = new MasterAddressTracker(zk, null); @@ -96,12 +96,14 @@ public class TestMasterAddressTracker { zk.registerListener(addressTracker); // Use a listener to capture when the node is actually created - NodeCreationListener listener = new NodeCreationListener(zk, zk.znodePaths.masterAddressZNode); + NodeCreationListener listener = new NodeCreationListener(zk, + zk.getZNodePaths().masterAddressZNode); zk.registerListener(listener); if (sn != null) { LOG.info("Creating master node"); - MasterAddressTracker.setMasterAddress(zk, zk.znodePaths.masterAddressZNode, sn, infoPort); + MasterAddressTracker.setMasterAddress(zk, zk.getZNodePaths().masterAddressZNode, + sn, infoPort); // Wait for the node to be created LOG.info("Waiting for master address manager to be notified"); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java index 1b51ae4..131158b 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java @@ -106,7 +106,7 @@ public class TestRegionServerHostname { TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); try { ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher(); - List<String> servers = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.rsZNode); + List<String> servers = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().rsZNode); // there would be NUM_RS+1 children - one for the master assertTrue(servers.size() == NUM_RS + (LoadBalancer.isTablesOnMaster(TEST_UTIL.getConfiguration())? 1: 0)); @@ -167,7 +167,7 @@ public class TestRegionServerHostname { boolean tablesOnMaster = LoadBalancer.isTablesOnMaster(TEST_UTIL.getConfiguration()); int expectedRS = NUM_RS + (tablesOnMaster? 1: 0); try (ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher()) { - List<String> servers = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.rsZNode); + List<String> servers = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().rsZNode); assertEquals(expectedRS, servers.size()); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java index b3e9e8c..0c38ee3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java @@ -204,16 +204,16 @@ public class TestSplitLogWorker { zkw = new ZKWatcher(TEST_UTIL.getConfiguration(), "split-log-worker-tests", null); ds = new DummyServer(zkw, conf); - ZKUtil.deleteChildrenRecursively(zkw, zkw.znodePaths.baseZNode); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.baseZNode); - assertThat(ZKUtil.checkExists(zkw, zkw.znodePaths.baseZNode), not (is(-1))); - LOG.debug(zkw.znodePaths.baseZNode + " created"); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.splitLogZNode); - assertThat(ZKUtil.checkExists(zkw, zkw.znodePaths.splitLogZNode), not (is(-1))); + ZKUtil.deleteChildrenRecursively(zkw, zkw.getZNodePaths().baseZNode); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().baseZNode); + assertThat(ZKUtil.checkExists(zkw, zkw.getZNodePaths().baseZNode), not(is(-1))); + LOG.debug(zkw.getZNodePaths().baseZNode + " created"); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().splitLogZNode); + assertThat(ZKUtil.checkExists(zkw, zkw.getZNodePaths().splitLogZNode), not(is(-1))); - LOG.debug(zkw.znodePaths.splitLogZNode + " created"); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.rsZNode); - assertThat(ZKUtil.checkExists(zkw, zkw.znodePaths.rsZNode), not (is(-1))); + LOG.debug(zkw.getZNodePaths().splitLogZNode + " created"); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().rsZNode); + assertThat(ZKUtil.checkExists(zkw, zkw.getZNodePaths().rsZNode), not(is(-1))); SplitLogCounters.resetCounters(); executorService = new ExecutorService("TestSplitLogWorker"); @@ -430,7 +430,7 @@ public class TestSplitLogWorker { waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 1, 2, WAIT_TIME); waitForCounter(SplitLogCounters.tot_wkr_task_acquired_rescan, 0, 1, WAIT_TIME); - List<String> nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.splitLogZNode); + List<String> nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().splitLogZNode); LOG.debug(Objects.toString(nodes)); int num = 0; for (String node : nodes) { @@ -438,7 +438,8 @@ public class TestSplitLogWorker { if (node.startsWith("RESCAN")) { String name = ZKSplitLog.getEncodedNodeName(zkw, node); String fn = ZKSplitLog.getFileName(name); - byte [] data = ZKUtil.getData(zkw, ZNodePaths.joinZNode(zkw.znodePaths.splitLogZNode, fn)); + byte [] data = ZKUtil.getData(zkw, + ZNodePaths.joinZNode(zkw.getZNodePaths().splitLogZNode, fn)); slt = SplitLogTask.parseFrom(data); assertTrue(slt.toString(), slt.isDone(SRV)); } @@ -494,9 +495,9 @@ public class TestSplitLogWorker { RegionServerServices mockedRS = getRegionServer(RS); // create two RS nodes - String rsPath = ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, RS.getServerName()); + String rsPath = ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, RS.getServerName()); zkw.getRecoverableZooKeeper().create(rsPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); - rsPath = ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, RS2.getServerName()); + rsPath = ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, RS2.getServerName()); zkw.getRecoverableZooKeeper().create(rsPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); for (int i = 0; i < maxTasks; i++) { http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java index 77b4c1b..65eac4a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java @@ -83,13 +83,14 @@ public class TestReplicationTrackerZKImpl { utility.startMiniZKCluster(); conf = utility.getConfiguration(); ZKWatcher zk = HBaseTestingUtility.getZooKeeperWatcher(utility); - ZKUtil.createWithParents(zk, zk.znodePaths.rsZNode); + ZKUtil.createWithParents(zk, zk.getZNodePaths().rsZNode); } @Before public void setUp() throws Exception { zkw = HBaseTestingUtility.getZooKeeperWatcher(utility); - String fakeRs1 = ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname1.example.org:1234"); + String fakeRs1 = ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, + "hostname1.example.org:1234"); try { ZKClusterId.setClusterId(zkw, new ClusterId()); rp = ReplicationFactory.getReplicationPeers(zkw, conf); @@ -115,34 +116,34 @@ public class TestReplicationTrackerZKImpl { // 1 region server ZKUtil.createWithParents(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname1.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname1.example.org:1234")); assertEquals(1, rt.getListOfRegionServers().size()); // 2 region servers ZKUtil.createWithParents(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname2.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname2.example.org:1234")); assertEquals(2, rt.getListOfRegionServers().size()); // 1 region server ZKUtil.deleteNode(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname2.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname2.example.org:1234")); assertEquals(1, rt.getListOfRegionServers().size()); // 0 region server ZKUtil.deleteNode(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname1.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname1.example.org:1234")); assertEquals(0, rt.getListOfRegionServers().size()); } @Test public void testRegionServerRemovedEvent() throws Exception { ZKUtil.createAndWatch(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname2.example.org:1234"), + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname2.example.org:1234"), HConstants.EMPTY_BYTE_ARRAY); rt.registerListener(new DummyReplicationListener()); // delete one ZKUtil.deleteNode(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname2.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname2.example.org:1234")); // wait for event while (rsRemovedCount.get() < 1) { Thread.sleep(5); http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-zookeeper/pom.xml ---------------------------------------------------------------------- diff --git a/hbase-zookeeper/pom.xml b/hbase-zookeeper/pom.xml index a7cde51..b96c717 100644 --- a/hbase-zookeeper/pom.xml +++ b/hbase-zookeeper/pom.xml @@ -92,6 +92,13 @@ <artifactId>findbugs-maven-plugin</artifactId> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <configuration> + <failOnViolation>true</failOnViolation> + </configuration> + </plugin> + <plugin> <groupId>net.revelc.code</groupId> <artifactId>warbucks-maven-plugin</artifactId> </plugin> http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java ---------------------------------------------------------------------- diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java index 730c099..c78d69a 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java @@ -48,7 +48,7 @@ public class ClusterStatusTracker extends ZKNodeTracker { * @param abortable used to abort if a fatal error occurs */ public ClusterStatusTracker(ZKWatcher watcher, Abortable abortable) { - super(watcher, watcher.znodePaths.clusterStateZNode, abortable); + super(watcher, watcher.getZNodePaths().clusterStateZNode, abortable); } /** @@ -65,12 +65,12 @@ public class ClusterStatusTracker extends ZKNodeTracker { * @throws KeeperException unexpected zk exception */ public void setClusterUp() - throws KeeperException { + throws KeeperException { byte [] upData = toByteArray(); try { - ZKUtil.createAndWatch(watcher, watcher.znodePaths.clusterStateZNode, upData); + ZKUtil.createAndWatch(watcher, watcher.getZNodePaths().clusterStateZNode, upData); } catch(KeeperException.NodeExistsException nee) { - ZKUtil.setData(watcher, watcher.znodePaths.clusterStateZNode, upData); + ZKUtil.setData(watcher, watcher.getZNodePaths().clusterStateZNode, upData); } } @@ -79,12 +79,12 @@ public class ClusterStatusTracker extends ZKNodeTracker { * @throws KeeperException unexpected zk exception */ public void setClusterDown() - throws KeeperException { + throws KeeperException { try { - ZKUtil.deleteNode(watcher, watcher.znodePaths.clusterStateZNode); + ZKUtil.deleteNode(watcher, watcher.getZNodePaths().clusterStateZNode); } catch(KeeperException.NoNodeException nne) { LOG.warn("Attempted to set cluster as down but already down, cluster " + - "state node (" + watcher.znodePaths.clusterStateZNode + ") not found"); + "state node (" + watcher.getZNodePaths().clusterStateZNode + ") not found"); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/1b98a96c/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java ---------------------------------------------------------------------- diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java index d3085b7..0e74483 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java @@ -39,7 +39,7 @@ public class LoadBalancerTracker extends ZKNodeTracker { public LoadBalancerTracker(ZKWatcher watcher, Abortable abortable) { - super(watcher, watcher.znodePaths.balancerZNode, abortable); + super(watcher, watcher.getZNodePaths().balancerZNode, abortable); } /** @@ -67,11 +67,11 @@ public class LoadBalancerTracker extends ZKNodeTracker { byte [] upData = toByteArray(balancerOn); try { - ZKUtil.setData(watcher, watcher.znodePaths.balancerZNode, upData); + ZKUtil.setData(watcher, watcher.getZNodePaths().balancerZNode, upData); } catch(KeeperException.NoNodeException nne) { - ZKUtil.createAndWatch(watcher, watcher.znodePaths.balancerZNode, upData); + ZKUtil.createAndWatch(watcher, watcher.getZNodePaths().balancerZNode, upData); } - super.nodeDataChanged(watcher.znodePaths.balancerZNode); + super.nodeDataChanged(watcher.getZNodePaths().balancerZNode); } private byte [] toByteArray(boolean isBalancerOn) { @@ -82,7 +82,7 @@ public class LoadBalancerTracker extends ZKNodeTracker { } private LoadBalancerProtos.LoadBalancerState parseFrom(byte [] pbBytes) - throws DeserializationException { + throws DeserializationException { ProtobufUtil.expectPBMagicPrefix(pbBytes); LoadBalancerProtos.LoadBalancerState.Builder builder = LoadBalancerProtos.LoadBalancerState.newBuilder();