lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1588461 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/test/org/apache/solr/cloud/ solr/test-framework/ solr/test-framework/src/java/org/apache/solr/cloud/
Date Fri, 18 Apr 2014 13:10:04 GMT
Author: markrmiller
Date: Fri Apr 18 13:10:04 2014
New Revision: 1588461

URL: http://svn.apache.org/r1588461
Log:
SOLR-5989: Pass add and delete fails to checkShardConsistency call in ChaosMonkeyNothingisSafeTest
so that legal differences are ignored.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
    lucene/dev/branches/branch_4x/solr/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java?rev=1588461&r1=1588460&r2=1588461&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
Fri Apr 18 13:10:04 2014
@@ -19,6 +19,7 @@ package org.apache.solr.cloud;
 
 import java.net.ConnectException;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -130,11 +131,13 @@ public class ChaosMonkeyNothingIsSafeTes
        del("*:*");
       
       List<StopableThread> threads = new ArrayList<>();
+      List<StopableIndexingThread> indexTreads = new ArrayList<>();
       int threadCount = TEST_NIGHTLY ? 3 : 1;
       int i = 0;
       for (i = 0; i < threadCount; i++) {
         StopableIndexingThread indexThread = new StopableIndexingThread(controlClient, cloudClient,
Integer.toString(i), true);
         threads.add(indexThread);
+        indexTreads.add(indexThread);
         indexThread.start();
       }
       
@@ -215,9 +218,12 @@ public class ChaosMonkeyNothingIsSafeTes
         }
       }
       
+      
+      Set<String> addFails = getAddFails(indexTreads);
+      Set<String> deleteFails = getDeleteFails(indexTreads);
       // full throttle thread can
       // have request fails 
-      checkShardConsistency(!runFullThrottle, true);
+      checkShardConsistency(!runFullThrottle, true, addFails, deleteFails);
       
       long ctrlDocs = controlClient.query(new SolrQuery("*:*")).getResults()
       .getNumFound(); 
@@ -252,7 +258,7 @@ public class ChaosMonkeyNothingIsSafeTes
       List<Integer> numShardsNumReplicas = new ArrayList<>(2);
       numShardsNumReplicas.add(1);
       numShardsNumReplicas.add(1);
-      checkForCollection("testcollection",numShardsNumReplicas, null);
+      checkForCollection("testcollection", numShardsNumReplicas, null);
       
       testsSuccesful = true;
     } finally {
@@ -262,6 +268,22 @@ public class ChaosMonkeyNothingIsSafeTes
     }
   }
 
+  private Set<String> getAddFails(List<StopableIndexingThread> threads) {
+    Set<String> addFails = new HashSet<String>();
+    for (StopableIndexingThread thread : threads)   {
+      addFails.addAll(thread.getAddFails());
+    }
+    return addFails;
+  }
+  
+  private Set<String> getDeleteFails(List<StopableIndexingThread> threads) {
+    Set<String> deleteFails = new HashSet<String>();
+    for (StopableIndexingThread thread : threads)   {
+      deleteFails.addAll(thread.getDeleteFails());
+    }
+    return deleteFails;
+  }
+
   class FullThrottleStopableIndexingThread extends StopableIndexingThread {
     private HttpClient httpClient = HttpClientUtil.createClient(null);
     private volatile boolean stop = false;

Modified: lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java?rev=1588461&r1=1588460&r2=1588461&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
(original)
+++ lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
Fri Apr 18 13:10:04 2014
@@ -1117,10 +1117,7 @@ public abstract class AbstractFullDistri
     return sb.toString();
   }
   
-  boolean checkForLegalDiff(SolrDocumentList a, SolrDocumentList b, String aName, String
bName, Set<String> addFails, Set<String> deleteFails) {
-    // System.err.println("######"+aName+ ": " + toStr(a,10));
-    //  System.err.println("######"+bName+ ": " + toStr(b,10));
-    //System.err.println("###### sizes=" + a.size() + "," + b.size());
+  boolean checkIfDiffIsLegal(SolrDocumentList a, SolrDocumentList b, String aName, String
bName, Set<String> addFails, Set<String> deleteFails) {
     boolean legal = true;
     Set<SolrDocument> setA = new HashSet<>();
     for (SolrDocument sdoc : a) {
@@ -1305,7 +1302,7 @@ public abstract class AbstractFullDistri
     };
 
     if (addFails != null || deleteFails != null) {
-      boolean legal = checkForLegalDiff(controlDocList, cloudDocList,
+      boolean legal = checkIfDiffIsLegal(controlDocList, cloudDocList,
           "controlDocList", "cloudDocList", addFails, deleteFails);
       if (legal) {
         return false;



Mime
View raw message