helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject git commit: HELIX-41: fix intermittent test failures
Date Thu, 07 Feb 2013 19:02:05 GMT
Updated Branches:
  refs/heads/master 88cd21432 -> 98b6c97ad


HELIX-41: fix intermittent test failures


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

Branch: refs/heads/master
Commit: 98b6c97ad8519df3680630f0adc7729cec57e72a
Parents: 88cd214
Author: zzhang <zzhang5@uci.edu>
Authored: Thu Feb 7 11:01:55 2013 -0800
Committer: zzhang <zzhang5@uci.edu>
Committed: Thu Feb 7 11:01:55 2013 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/helix/PropertyKey.java    |    6 ++
 .../controller/stages/TaskAssignmentStage.java     |    4 ++
 .../TestAddStateModelFactoryAfterConnect.java      |   40 ++++++---------
 3 files changed, 26 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/98b6c97a/helix-core/src/main/java/org/apache/helix/PropertyKey.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/PropertyKey.java b/helix-core/src/main/java/org/apache/helix/PropertyKey.java
index fa26915..554691f 100644
--- a/helix-core/src/main/java/org/apache/helix/PropertyKey.java
+++ b/helix-core/src/main/java/org/apache/helix/PropertyKey.java
@@ -107,6 +107,11 @@ public class PropertyKey
     return super.hashCode();
   }
 
+  @Override
+  public String toString() {
+	  return getPath();
+  }
+  
   public String getPath()
   {
     String clusterName = _params[0];
@@ -576,4 +581,5 @@ public class PropertyKey
   {
 	  return _configScope;
   }
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/98b6c97a/helix-core/src/main/java/org/apache/helix/controller/stages/TaskAssignmentStage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/stages/TaskAssignmentStage.java
b/helix-core/src/main/java/org/apache/helix/controller/stages/TaskAssignmentStage.java
index 0a6c250..2a8137c 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/stages/TaskAssignmentStage.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/stages/TaskAssignmentStage.java
@@ -136,6 +136,10 @@ public class TaskAssignmentStage extends AbstractBaseStage
           + " transit " + message.getPartitionName() + "|" + message.getPartitionNames()
           + " from:" + message.getFromState() + " to:" + message.getToState());
 
+//      System.out.println("[dbg]Sending Message " + message.getMsgId() + " to " + message.getTgtName()
+//              + " transit " + message.getPartitionName() + "|" + message.getPartitionNames()
+//              + " from: " + message.getFromState() + " to: " + message.getToState());
+
       keys.add(keyBuilder.message(message.getTgtName(), message.getId()));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/98b6c97a/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java
b/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java
index 61f3de5..e195cc7 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java
@@ -34,6 +34,7 @@ import org.apache.helix.mock.participant.MockMSModelFactory;
 import org.apache.helix.model.CurrentState;
 import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.IdealState;
+import org.apache.helix.model.Message;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
@@ -98,31 +99,22 @@ public class TestAddStateModelFactoryAfterConnect extends ZkIntegrationTestBase
     accessor.setProperty(keyBuilder.idealStates("TestDB1"), idealState);
     setupTool.rebalanceStorageCluster(clusterName, "TestDB1", 3);
 
-    // external view for TestDB1 should be empty
-    ExternalView extView = null;
-    for (int i = 0; i < 10; i++)
-    {
-      Thread.sleep(100);
-      extView = accessor.getProperty(keyBuilder.externalView("TestDB1"));
-
-      if (extView != null)
-    	  break;
+    // assert that we have received OFFLINE->SLAVE messages for all partitions
+    int totalMsgs = 0;
+    for (int retry = 0; retry < 5; retry++) {
+    	Thread.sleep(100);
+    	totalMsgs = 0;
+        for (int i = 0; i < n; i++) {
+        	List<Message> msgs = accessor.getChildValues(keyBuilder.messages(participants[i].getInstanceName()));
+        	totalMsgs += msgs.size();
+        }
+        
+        if (totalMsgs == 48) // partition# x replicas
+        	break;
     }
-
-    if (extView == null) {
-    	// output current-state for debug
-    	List<CurrentState> curStates = new ArrayList<CurrentState>();
-    	for (int i = 0; i < n; i++) {
-    		CurrentState curState = accessor.getProperty(keyBuilder.currentState(participants[i].getInstanceName(),

-    				participants[i].getManager().getSessionId(), "TestDB1"));
-    		curStates.add(curState);
-    	}
-    	Assert.fail("Timeout waiting for an empty external view of TestDB1. curStates: " + curStates);
-    }
-
-    Assert.assertEquals(extView.getRecord().getMapFields().size(),
-                        0,
-                        "External view for TestDB1 should be empty since TestDB1 is added
without a state model factory");
+    
+    Assert.assertEquals(totalMsgs, 48,
+      "Should accumulated 48 unprocessed messages (1 O->S per partition per replica) because
TestDB1 is added without state-model-factory but was " + totalMsgs);
 
     // register "TestDB1_Factory" state model factory
     // Logger.getRootLogger().setLevel(Level.INFO);


Mime
View raw message