You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ka...@apache.org on 2014/04/12 20:44:45 UTC

[1/2] git commit: [HELIX-429] Upgrade restlet to 2.2.0

Repository: helix
Updated Branches:
  refs/heads/helix-0.6.2-release ba2efd597 -> 8b0c373b5


[HELIX-429] Upgrade restlet to 2.2.0


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/c10f3049
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/c10f3049
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/c10f3049

Branch: refs/heads/helix-0.6.2-release
Commit: c10f3049c98f03b7a73d4f6125d32802e938ebea
Parents: ba2efd5
Author: Kanak Biscuitwala <ka...@apache.org>
Authored: Sat Apr 12 11:34:44 2014 -0700
Committer: Kanak Biscuitwala <ka...@apache.org>
Committed: Sat Apr 12 11:34:44 2014 -0700

----------------------------------------------------------------------
 helix-core/pom.xml | 4 ++--
 pom.xml            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/c10f3049/helix-core/pom.xml
----------------------------------------------------------------------
diff --git a/helix-core/pom.xml b/helix-core/pom.xml
index ee09bf9..00781df 100644
--- a/helix-core/pom.xml
+++ b/helix-core/pom.xml
@@ -45,7 +45,7 @@ under the License.
       org.apache.zookeeper.txn*;resolution:=optional,
       org.apache.zookeeper*;version="[3.3,4)",
       org.codehaus.jackson*;version="[1.8,2)",
-      org.restlet;version="[2.1.4,3]",
+      org.restlet;version="[2.2.0,3]",
       *
     </osgi.import>
     <osgi.ignore>
@@ -133,7 +133,7 @@ under the License.
     <dependency>
       <groupId>org.restlet.jse</groupId>
       <artifactId>org.restlet</artifactId>
-      <version>2.1.4</version>
+      <version>2.2.0</version>
     </dependency>
     <dependency>
       <groupId>com.google.guava</groupId>

http://git-wip-us.apache.org/repos/asf/helix/blob/c10f3049/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 77eb495..3f446f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -260,7 +260,7 @@ under the License.
       <dependency>
         <groupId>org.restlet.jse</groupId>
         <artifactId>org.restlet</artifactId>
-        <version>2.1.4</version>
+        <version>2.2.0</version>
       </dependency>
       <dependency>
         <groupId>org.apache.helix</groupId>


[2/2] git commit: [HELIX-410] Fix parsing and filtering of resources in ClusterStateVerifier

Posted by ka...@apache.org.
[HELIX-410] Fix parsing and filtering of resources in ClusterStateVerifier


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/8b0c373b
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/8b0c373b
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/8b0c373b

Branch: refs/heads/helix-0.6.2-release
Commit: 8b0c373b551499bdc4d5268af1d95a7b9c0442bf
Parents: c10f304
Author: Kanak Biscuitwala <ka...@apache.org>
Authored: Thu Mar 20 15:41:09 2014 -0700
Committer: Kanak Biscuitwala <ka...@apache.org>
Committed: Sat Apr 12 11:41:15 2014 -0700

----------------------------------------------------------------------
 .../stages/BestPossibleStateCalcStage.java      |  1 +
 .../helix/tools/ClusterStateVerifier.java       | 26 +++++++++++++++++---
 .../helix/tools/TestClusterStateVerifier.java   |  5 ++++
 3 files changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/8b0c373b/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java b/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
index cc171a0..458218c 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
@@ -88,6 +88,7 @@ public class BestPossibleStateCalcStage extends AbstractBaseStage {
         // if ideal state is deleted, use an empty one
         logger.info("resource:" + resourceName + " does not exist anymore");
         idealState = new IdealState(resourceName);
+        idealState.setStateModelDefRef(resource.getStateModelDefRef());
       }
 
       Rebalancer rebalancer = null;

http://git-wip-us.apache.org/repos/asf/helix/blob/8b0c373b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
index 3a3a09e..bd749c3 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
@@ -60,6 +60,7 @@ import org.apache.helix.manager.zk.ZkClient;
 import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.model.Partition;
+import org.apache.helix.model.Resource;
 import org.apache.helix.util.ZKClientPool;
 import org.apache.log4j.Logger;
 
@@ -269,7 +270,8 @@ public class ClusterStateVerifier {
       }
 
       // calculate best possible state
-      BestPossibleStateOutput bestPossOutput = ClusterStateVerifier.calcBestPossState(cache);
+      BestPossibleStateOutput bestPossOutput =
+          ClusterStateVerifier.calcBestPossState(cache, resources);
       Map<String, Map<Partition, Map<String, String>>> bestPossStateMap =
           bestPossOutput.getStateMap();
 
@@ -426,8 +428,12 @@ public class ClusterStateVerifier {
    * @return
    * @throws Exception
    */
-
   static BestPossibleStateOutput calcBestPossState(ClusterDataCache cache) throws Exception {
+    return calcBestPossState(cache, null);
+  }
+
+  static BestPossibleStateOutput calcBestPossState(ClusterDataCache cache, Set<String> resources)
+      throws Exception {
     ClusterEvent event = new ClusterEvent("sampleEvent");
     event.addAttribute("ClusterDataCache", cache);
 
@@ -436,6 +442,13 @@ public class ClusterStateVerifier {
     BestPossibleStateCalcStage bpStage = new BestPossibleStateCalcStage();
 
     runStage(event, rcState);
+
+    // Filter resources if specified
+    if (resources != null) {
+      Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.toString());
+      resourceMap.keySet().retainAll(resources);
+    }
+
     runStage(event, csStage);
     runStage(event, bpStage);
 
@@ -597,12 +610,19 @@ public class ClusterStateVerifier {
     sleepIntervalOption.setArgs(1);
     sleepIntervalOption.setArgName("Polling period value (Optional), default=1s");
 
+    Option resourcesOption =
+        OptionBuilder.withLongOpt(resources).withDescription("Specific set of resources to verify")
+            .create();
+    resourcesOption.setArgs(1);
+    resourcesOption.setArgName("Comma-separated resource names, default is all resources");
+
     Options options = new Options();
     options.addOption(helpOption);
     options.addOption(zkServerOption);
     options.addOption(clusterOption);
     options.addOption(timeoutOption);
     options.addOption(sleepIntervalOption);
+    options.addOption(resourcesOption);
 
     return options;
   }
@@ -664,7 +684,7 @@ public class ClusterStateVerifier {
 
       // Allow specifying resources explicitly
       if (resourceStr != null) {
-        String[] resources = resourceStr.split(resourceStr);
+        String[] resources = resourceStr.split("[\\s,]");
         resourceSet = Sets.newHashSet(resources);
       }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/8b0c373b/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java b/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java
index ae154d3..dc6bd45 100644
--- a/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java
+++ b/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java
@@ -119,6 +119,11 @@ public class TestClusterStateVerifier extends ZkUnitTestBase {
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
             _clusterName, null, Sets.newHashSet(RESOURCES[1])));
     Assert.assertTrue(result);
+    String[] args = {
+        "--zkSvr", ZK_ADDR, "--cluster", _clusterName, "--resources", RESOURCES[1]
+    };
+    result = ClusterStateVerifier.verifyState(args);
+    Assert.assertTrue(result);
 
     // But the full cluster verification should fail
     boolean fullResult = new BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName).verify();