Updated Branches: refs/heads/trunk 0deccf5a2 -> 26d31606b
GIRAPH-805 Project: http://git-wip-us.apache.org/repos/asf/giraph/repo Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/26d31606 Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/26d31606 Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/26d31606 Branch: refs/heads/trunk Commit: 26d31606bda1000638b7fec59e1914aa83e1c71a Parents: 0deccf5 Author: Claudio Martella <[email protected]> Authored: Mon Jan 20 19:04:51 2014 +0100 Committer: Claudio Martella <[email protected]> Committed: Mon Jan 20 19:04:51 2014 +0100 ---------------------------------------------------------------------- CHANGELOG | 2 ++ .../org/apache/giraph/conf/GiraphConfiguration.java | 6 +++--- .../java/org/apache/giraph/conf/GiraphConstants.java | 7 ++++++- .../org/apache/giraph/graph/GraphTaskManager.java | 2 +- .../org/apache/giraph/utils/InternalVertexRunner.java | 6 +++--- .../org/apache/giraph/zk/GiraphZooKeeperAdmin.java | 14 ++++++++------ 6 files changed, 23 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/giraph/blob/26d31606/CHANGELOG ---------------------------------------------------------------------- diff --git a/CHANGELOG b/CHANGELOG index 135ba78..dd86f1c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ Giraph Change Log Release 1.1.0 - unreleased + GIRAPH-805: getZookeeperList can return null (armax00 via claudio) + GIRAPH-823: upgrade hiveio to version 0.21 from olderversion 0.20 (pavanka via majakabiljo) GIRAPH-724: UnsafeByteArrayOutputStream.writeUTF should call ensureSize (yhdong via majakabiljo) http://git-wip-us.apache.org/repos/asf/giraph/blob/26d31606/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfiguration.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfiguration.java b/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfiguration.java index c8b7d36..e378147 100644 --- a/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfiguration.java +++ b/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfiguration.java @@ -625,7 +625,7 @@ public class GiraphConfiguration extends Configuration * (i.e. zk1:2221,zk2:2221) */ public final void setZooKeeperConfiguration(String serverList) { - set(ZOOKEEPER_LIST, serverList); + ZOOKEEPER_LIST.set(this, serverList); } /** @@ -728,7 +728,7 @@ public class GiraphConfiguration extends Configuration * @return ZooKeeper list of strings, comma separated or null if none set. */ public String getZookeeperList() { - return get(ZOOKEEPER_LIST); + return ZOOKEEPER_LIST.get(this); } /** @@ -739,7 +739,7 @@ public class GiraphConfiguration extends Configuration * @param zkList list of strings, comma separated of zookeeper servers */ public void setZookeeperList(String zkList) { - set(ZOOKEEPER_LIST, zkList); + ZOOKEEPER_LIST.set(this, zkList); ZOOKEEPER_IS_EXTERNAL.set(this, false); } http://git-wip-us.apache.org/repos/asf/giraph/blob/26d31606/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java b/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java index 63f38df..aca0c16 100644 --- a/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java +++ b/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConstants.java @@ -408,7 +408,12 @@ public interface GiraphConstants { * zookeeper, this parameter will updated the configuration with the corrent * configuration value. */ - String ZOOKEEPER_LIST = "giraph.zkList"; + StrConfOption ZOOKEEPER_LIST = + new StrConfOption("giraph.zkList", "", + "ZooKeeper comma-separated list (if not set, will start up " + + "ZooKeeper locally). Consider that after locally-starting " + + "zookeeper, this parameter will updated the configuration with " + + "the corrent configuration value."); /** * Zookeeper List will always hold a value during the computation while http://git-wip-us.apache.org/repos/asf/giraph/blob/26d31606/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java b/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java index f31d99e..0617973 100644 --- a/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java +++ b/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java @@ -199,7 +199,7 @@ public class GraphTaskManager<I extends WritableComparable, V extends Writable, context.setStatus("setup: Initializing Zookeeper services."); locateZookeeperClasspath(zkPathList); String serverPortList = conf.getZookeeperList(); - if (serverPortList == null && startZooKeeperManager()) { + if (serverPortList.isEmpty() && startZooKeeperManager()) { return; // ZK connect/startup failed } if (zkManager != null && zkManager.runsZooKeeper()) { http://git-wip-us.apache.org/repos/asf/giraph/blob/26d31606/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java b/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java index 16e2f6a..3f49395 100644 --- a/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java +++ b/giraph-core/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java @@ -129,8 +129,8 @@ public class InternalVertexRunner { conf.setWorkerConfiguration(1, 1, 100.0f); GiraphConstants.SPLIT_MASTER_WORKER.set(conf, false); GiraphConstants.LOCAL_TEST_MODE.set(conf, true); - conf.set(GiraphConstants.ZOOKEEPER_LIST, "localhost:" + - String.valueOf(LOCAL_ZOOKEEPER_PORT)); + conf.setZookeeperList("localhost:" + + String.valueOf(LOCAL_ZOOKEEPER_PORT)); conf.set(GiraphConstants.ZOOKEEPER_DIR, zkDir.toString()); GiraphConstants.ZOOKEEPER_MANAGER_DIRECTORY.set(conf, @@ -230,7 +230,7 @@ public class InternalVertexRunner { conf.setWorkerConfiguration(1, 1, 100.0f); GiraphConstants.SPLIT_MASTER_WORKER.set(conf, false); GiraphConstants.LOCAL_TEST_MODE.set(conf, true); - conf.set(GiraphConstants.ZOOKEEPER_LIST, "localhost:" + + GiraphConstants.ZOOKEEPER_LIST.set(conf, "localhost:" + String.valueOf(LOCAL_ZOOKEEPER_PORT)); conf.set(GiraphConstants.ZOOKEEPER_DIR, zkDir.toString()); http://git-wip-us.apache.org/repos/asf/giraph/blob/26d31606/giraph-core/src/main/java/org/apache/giraph/zk/GiraphZooKeeperAdmin.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/zk/GiraphZooKeeperAdmin.java b/giraph-core/src/main/java/org/apache/giraph/zk/GiraphZooKeeperAdmin.java index 19f6be5..dbb2096 100644 --- a/giraph-core/src/main/java/org/apache/giraph/zk/GiraphZooKeeperAdmin.java +++ b/giraph-core/src/main/java/org/apache/giraph/zk/GiraphZooKeeperAdmin.java @@ -19,6 +19,7 @@ package org.apache.giraph.zk; import org.apache.giraph.bsp.BspService; +import org.apache.giraph.conf.GiraphConfiguration; import org.apache.giraph.conf.GiraphConstants; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.Tool; @@ -76,17 +77,18 @@ public class GiraphZooKeeperAdmin implements Watcher, Tool { */ @Override public int run(String[] args) { - final int zkPort = ZOOKEEPER_SERVER_PORT.get(getConf()); - final String zkBasePath = getConf().get( + final GiraphConfiguration giraphConf = new GiraphConfiguration(getConf()); + final int zkPort = ZOOKEEPER_SERVER_PORT.get(giraphConf); + final String zkBasePath = giraphConf.get( GiraphConstants.BASE_ZNODE_KEY, "") + BspService.BASE_DIR; final String[] zkServerList; - try { - zkServerList = getConf() - .get(GiraphConstants.ZOOKEEPER_LIST).split(","); - } catch (NullPointerException npe) { + String zkServerListStr = giraphConf.getZookeeperList(); + if (zkServerListStr.isEmpty()) { throw new IllegalStateException("GiraphZooKeeperAdmin requires a list " + "of ZooKeeper servers to clean."); } + zkServerList = zkServerListStr.split(","); + out.println("[GIRAPH-ZKADMIN] Attempting to clean Zookeeper " + "hosts at: " + Arrays.deepToString(zkServerList)); out.println("[GIRAPH-ZKADMIN] Connecting on port: " + zkPort);
