Repository: giraph Updated Branches: refs/heads/trunk cf6abc09a -> 8eb1f763d
GIRAPH-1078 createZooKeeperServerList should use task instead of port number Summary: createZooKeeperServerList doesn't have a port yet, as we haven't started zookeeper. What we actually have is the task number. Port will be later set by the master. Test Plan: run a few jobs. Reviewers: maja.kabiljo, majakabiljo, heslami, dionysis.logothetis Reviewed By: dionysis.logothetis Differential Revision: https://reviews.facebook.net/D59961 Project: http://git-wip-us.apache.org/repos/asf/giraph/repo Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/8eb1f763 Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/8eb1f763 Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/8eb1f763 Branch: refs/heads/trunk Commit: 8eb1f763d0cb0f98de1f12e3d48d9c516f5ac7a8 Parents: cf6abc0 Author: Sergey Edunov <[email protected]> Authored: Fri Jun 24 10:15:30 2016 -0700 Committer: Sergey Edunov <[email protected]> Committed: Fri Jun 24 10:15:30 2016 -0700 ---------------------------------------------------------------------- .../org/apache/giraph/zk/ZooKeeperManager.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/giraph/blob/8eb1f763/giraph-core/src/main/java/org/apache/giraph/zk/ZooKeeperManager.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/zk/ZooKeeperManager.java b/giraph-core/src/main/java/org/apache/giraph/zk/ZooKeeperManager.java index cac4315..d3ace99 100644 --- a/giraph-core/src/main/java/org/apache/giraph/zk/ZooKeeperManager.java +++ b/giraph-core/src/main/java/org/apache/giraph/zk/ZooKeeperManager.java @@ -304,14 +304,11 @@ public class ZooKeeperManager { */ private void createZooKeeperServerList() throws IOException, InterruptedException { - String host = null; - int port = 0; - while (host == null) { + String host; + String task; + while (true) { FileStatus [] fileStatusArray = fs.listStatus(taskDirectory); if (fileStatusArray.length > 0) { - checkState(fileStatusArray.length == 1, - "createZooKeeperServerList: too many " + - "status files found " + Arrays.toString(fileStatusArray)); FileStatus fileStatus = fileStatusArray[0]; String[] hostnameTaskArray = fileStatus.getPath().getName().split( @@ -320,14 +317,14 @@ public class ZooKeeperManager { "createZooKeeperServerList: Task 0 failed " + "to parse " + fileStatus.getPath().getName()); host = hostnameTaskArray[0]; - port = Integer.parseInt(hostnameTaskArray[1]); - Thread.sleep(pollMsecs); + task = hostnameTaskArray[1]; + break; } + Thread.sleep(pollMsecs); } String serverListFile = ZOOKEEPER_SERVER_LIST_FILE_PREFIX + host + - HOSTNAME_TASK_SEPARATOR + port + - HOSTNAME_TASK_SEPARATOR; + HOSTNAME_TASK_SEPARATOR + task; Path serverListPath = new Path(baseDirectory, serverListFile); if (LOG.isInfoEnabled()) { @@ -573,7 +570,7 @@ public class ZooKeeperManager { } } else { if (LOG.isInfoEnabled()) { - LOG.info("onlineZooKeeperSErvers: Empty " + + LOG.info("onlineZooKeeperServers: Empty " + "directory " + serverDirectory + ", waiting " + pollMsecs + " msecs."); }
