Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 57601200B64 for ; Tue, 2 Aug 2016 18:01:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 55F60160AA8; Tue, 2 Aug 2016 16:01:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9D51F160A65 for ; Tue, 2 Aug 2016 18:01:47 +0200 (CEST) Received: (qmail 41583 invoked by uid 500); 2 Aug 2016 16:01:46 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 41574 invoked by uid 99); 2 Aug 2016 16:01:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Aug 2016 16:01:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 83B69E0007; Tue, 2 Aug 2016 16:01:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hossman@apache.org To: commits@lucene.apache.org Date: Tue, 02 Aug 2016 16:01:46 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] lucene-solr:master: SOLR-9363: tweak test to work around SOLR-9366 + SOLR-9367 since those issues are not key to what's being tested here archived-at: Tue, 02 Aug 2016 16:01:48 -0000 Repository: lucene-solr Updated Branches: refs/heads/branch_6x 77409fd43 -> c17605b4a refs/heads/master c60cd2529 -> 04321c401 SOLR-9363: tweak test to work around SOLR-9366 + SOLR-9367 since those issues are not key to what's being tested here Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/04321c40 Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/04321c40 Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/04321c40 Branch: refs/heads/master Commit: 04321c401c6584395c76c509f8513c5e5e4730ee Parents: c60cd25 Author: Chris Hostetter Authored: Tue Aug 2 08:50:13 2016 -0700 Committer: Chris Hostetter Committed: Tue Aug 2 08:50:13 2016 -0700 ---------------------------------------------------------------------- .../TestStressCloudBlindAtomicUpdates.java | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/04321c40/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> results = new ArrayList>(NUM_THREADS); for (int workerId = 0; workerId < NUM_THREADS; workerId++) {