You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2016/08/02 16:01:47 UTC

[2/2] lucene-solr:branch_6x: SOLR-9363: tweak test to work around SOLR-9366 + SOLR-9367 since those issues are not key to what's being tested here

SOLR-9363: tweak test to work around SOLR-9366 + SOLR-9367 since those issues are not key to what's being tested here

(cherry picked from commit 04321c401c6584395c76c509f8513c5e5e4730ee)


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

Branch: refs/heads/branch_6x
Commit: c17605b4a9978311b6b231f202d70dd800e473e6
Parents: 77409fd
Author: Chris Hostetter <ho...@apache.org>
Authored: Tue Aug 2 08:50:13 2016 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Tue Aug 2 08:50:34 2016 -0700

----------------------------------------------------------------------
 .../TestStressCloudBlindAtomicUpdates.java      | 23 ++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c17605b4/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
index 80bb98a..637f756 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
@@ -97,6 +97,14 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
    * larger index is used (so tested docs are more likeely to be spread out in multiple segments)
    */
   private static int DOC_ID_INCR;
+
+  /**
+   * The TestInjection configuration to be used for the current test method.
+   *
+   * Value is set by {@link #clearCloudCollection}, and used by {@link #startTestInjection} -- but only once 
+   * initial index seeding has finished (we're focusing on testing atomic updates, not basic indexing).
+   */
+  private String testInjection = null;
   
   @BeforeClass
   private static void createMiniSolrCloudCluster() throws Exception {
@@ -161,9 +169,17 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
     assertEquals(0, CLOUD_CLIENT.optimize().getStatus());
 
     TestInjection.reset();
-
+    
     final int injectionPercentage = (int)Math.ceil(atLeast(1) / 2);
-    final String testInjection = usually() ? "false:0" : ("true:" + injectionPercentage);
+    testInjection = usually() ? "false:0" : ("true:" + injectionPercentage);
+  }
+
+  /**
+   * Assigns {@link #testInjection} to various TestInjection variables.  Calling this 
+   * method multiple times in the same method should always result in the same setting being applied 
+   * (even if {@link TestInjection#reset} was called in between.
+   */
+  private void startTestInjection() {
     log.info("TestInjection: fail replica, update pause, tlog pauses: " + testInjection);
     TestInjection.failReplicaRequests = testInjection;
     TestInjection.updateLogReplayRandomPause = testInjection;
@@ -249,10 +265,13 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
     
     
     // sanity check index contents
+    waitForRecoveriesToFinish(CLOUD_CLIENT);
     assertEquals(0, CLOUD_CLIENT.commit().getStatus());
     assertEquals(numDocsInIndex,
                  CLOUD_CLIENT.query(params("q", "*:*")).getResults().getNumFound());
 
+    startTestInjection();
+    
     // spin up parallel workers to hammer updates
     List<Future<Worker>> results = new ArrayList<Future<Worker>>(NUM_THREADS);
     for (int workerId = 0; workerId < NUM_THREADS; workerId++) {