Updated Branches: refs/heads/master a243018a1 -> 22113e826
[Helix-5] Fixing a broken test case after removing deprecated api Project: http://git-wip-us.apache.org/repos/asf/incubator-helix/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-helix/commit/22113e82 Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/22113e82 Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/22113e82 Branch: refs/heads/master Commit: 22113e82623a086052904c2037b9719cc9257eff Parents: a243018 Author: Kishore Gopalakrishna <[email protected]> Authored: Wed Nov 14 10:23:56 2012 -0800 Committer: Kishore Gopalakrishna <[email protected]> Committed: Wed Nov 14 10:23:56 2012 -0800 ---------------------------------------------------------------------- .../java/org/apache/helix/BaseDataAccessor.java | 15 ++++ .../java/org/apache/helix/manager/zk/ZKUtil.java | 64 +++++++-------- .../org/apache/helix/store/zk/package-info.java | 2 +- .../helix/manager/zk/TestZkClusterManager.java | 3 +- 4 files changed, 48 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/22113e82/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java ---------------------------------------------------------------------- diff --git a/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java b/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java index cb453e6..fcbad00 100644 --- a/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java +++ b/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java @@ -46,6 +46,7 @@ public interface BaseDataAccessor<T> * * @param path * @param record + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ boolean set(String path, T record, int options); @@ -56,6 +57,7 @@ public interface BaseDataAccessor<T> * * @param path * @param record + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ boolean update(String path, DataUpdater<T> updater, int options); @@ -64,6 +66,7 @@ public interface BaseDataAccessor<T> * This will remove znode and all it's child nodes if any * * @param path + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ boolean remove(String path, int options); @@ -74,6 +77,7 @@ public interface BaseDataAccessor<T> * * @param parentPath * @param record + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ boolean[] createChildren(List<String> paths, List<T> records, int options); @@ -84,6 +88,7 @@ public interface BaseDataAccessor<T> * * @param parentPath * @param record + * @param options Set the type of ZNode see the valid values in {@link AccessOption} */ boolean[] setChildren(List<String> paths, List<T> records, int options); @@ -93,6 +98,7 @@ public interface BaseDataAccessor<T> * * @param parentPath * @param record + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ boolean[] updateChildren(List<String> paths, List<DataUpdater<T>> updaters, int options); @@ -101,6 +107,7 @@ public interface BaseDataAccessor<T> * remove multiple paths using async api. will remove any child nodes if any * * @param paths + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ boolean[] remove(List<String> paths, int options); @@ -109,6 +116,7 @@ public interface BaseDataAccessor<T> * Get the {@link T} corresponding to the path * * @param path + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ T get(String path, Stat stat, int options); @@ -117,6 +125,7 @@ public interface BaseDataAccessor<T> * Get List of {@link T} corresponding to the paths using async api * * @param paths + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ List<T> get(List<String> paths, List<Stat> stats, int options); @@ -125,6 +134,7 @@ public interface BaseDataAccessor<T> * Get the children under a parent path using async api * * @param path + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ List<T> getChildren(String parentPath, List<Stat> stats, int options); @@ -134,6 +144,7 @@ public interface BaseDataAccessor<T> * * @param type * @param keys + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ List<String> getChildNames(String parentPath, int options); @@ -142,6 +153,7 @@ public interface BaseDataAccessor<T> * checks if the path exists in zk * * @param path + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ boolean exists(String path, int options); @@ -150,6 +162,7 @@ public interface BaseDataAccessor<T> * checks if the all the paths exists * * @param paths + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ boolean[] exists(List<String> paths, int options); @@ -158,6 +171,7 @@ public interface BaseDataAccessor<T> * Get the stats of all the paths * * @param paths + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ Stat[] getStats(List<String> paths, int options); @@ -166,6 +180,7 @@ public interface BaseDataAccessor<T> * Get the stats of all the paths * * @param paths + * @param options Set the type of ZNode see the valid values in {@link AccessOption} * @return */ Stat getStat(String path, int options); http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/22113e82/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java ---------------------------------------------------------------------- diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java index b528904..5903d04 100644 --- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java +++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java @@ -48,40 +48,36 @@ public final class ZKUtil { return false; } - - boolean isValid = - zkClient.exists(PropertyPathConfig.getPath(PropertyType.IDEALSTATES, clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.CONFIGS, - clusterName, - ConfigScopeProperty.CLUSTER.toString(), - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.CONFIGS, - clusterName, - ConfigScopeProperty.PARTICIPANT.toString())) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.CONFIGS, - clusterName, - ConfigScopeProperty.RESOURCE.toString())) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.LIVEINSTANCES, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.INSTANCES, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.EXTERNALVIEW, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.CONTROLLER, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.STATEMODELDEFS, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.MESSAGES_CONTROLLER, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.ERRORS_CONTROLLER, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.STATUSUPDATES_CONTROLLER, - clusterName)) - && zkClient.exists(PropertyPathConfig.getPath(PropertyType.HISTORY, - clusterName)); - + ArrayList<String> requiredPaths = new ArrayList<String>(); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.IDEALSTATES, clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.CONFIGS, + clusterName, + ConfigScopeProperty.CLUSTER.toString(), + clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.CONFIGS, + clusterName, + ConfigScopeProperty.PARTICIPANT.toString())); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.CONFIGS, + clusterName, + ConfigScopeProperty.RESOURCE.toString())); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE,clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.LIVEINSTANCES,clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.INSTANCES,clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.EXTERNALVIEW,clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.CONTROLLER, clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.STATEMODELDEFS,clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.MESSAGES_CONTROLLER, clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.ERRORS_CONTROLLER, clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.STATUSUPDATES_CONTROLLER, clusterName)); + requiredPaths.add(PropertyPathConfig.getPath(PropertyType.HISTORY,clusterName)); + boolean isValid =true; + + for(String path:requiredPaths){ + if(!zkClient.exists(path)){ + isValid =false; + logger.error("Invalid cluster setup, missing znode path: "+path); + } + } return isValid; } http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/22113e82/helix-core/src/main/java/org/apache/helix/store/zk/package-info.java ---------------------------------------------------------------------- diff --git a/helix-core/src/main/java/org/apache/helix/store/zk/package-info.java b/helix-core/src/main/java/org/apache/helix/store/zk/package-info.java index 52319fb..b651848 100644 --- a/helix-core/src/main/java/org/apache/helix/store/zk/package-info.java +++ b/helix-core/src/main/java/org/apache/helix/store/zk/package-info.java @@ -17,7 +17,7 @@ * under the License. */ /** - * Helix implementation of zookeeper-based property store (Deprecated) + * Helix implementation of zookeeper-based property store * */ package org.apache.helix.store.zk; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/22113e82/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java index ca5e6cf..093499d 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java @@ -23,6 +23,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; +import org.apache.helix.AccessOption; import org.apache.helix.ConfigScope; import org.apache.helix.ConfigScopeBuilder; import org.apache.helix.HelixAdmin; @@ -94,7 +95,7 @@ public class TestZkClusterManager extends ZkUnitTestBase ZkHelixPropertyStore<ZNRecord> store = controller.getHelixPropertyStore(); ZNRecord record = new ZNRecord("node_1"); int options = 0; - store.set("node_1", record, options); + store.set("node_1", record, AccessOption.PERSISTENT); Stat stat = new Stat(); record = store.get("node_1",stat, options); AssertJUnit.assertEquals("node_1", record.getId());
