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/12/20 18:14:33 UTC

lucene-solr:jira/solr-5944: SOLR-5944: stop using the same seed in multiple AsyncUpdateWithRandomCommit instances

Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-5944 cef40ac16 -> 1a331ae01


SOLR-5944: stop using the same seed in multiple AsyncUpdateWithRandomCommit instances

using the same seed causes every instance to have identical behavior


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

Branch: refs/heads/jira/solr-5944
Commit: 1a331ae018dac7f58dfb4953fa9d94a1c947ec34
Parents: cef40ac
Author: Chris Hostetter <ho...@apache.org>
Authored: Tue Dec 20 11:14:25 2016 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Tue Dec 20 11:14:25 2016 -0700

----------------------------------------------------------------------
 .../solr/update/TestInPlaceUpdatesDistrib.java       | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a331ae0/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java
index 5b847d1..1ee1cae 100644
--- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java
+++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java
@@ -655,8 +655,6 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
     // Reordering needs to happen using parallel threads
     ExecutorService threadpool = 
         ExecutorUtil.newMDCAwareFixedThreadPool(updates.size() + 1, new DefaultSolrThreadFactory(getTestName()));
-    long seed = random().nextLong(); // seed for randomization within the threads
-
     // re-order the last two updates for NONLEADER 0
     List<UpdateRequest> reorderedUpdates = new ArrayList<>(updates);
     Collections.swap(reorderedUpdates, 2, 3);
@@ -666,7 +664,8 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
       // pretend as this update is coming from the other non-leader, so that
       // the resurrection can happen from there (instead of the leader)
       update.setParam(DistributedUpdateProcessor.DISTRIB_FROM, ((HttpSolrClient)NONLEADERS.get(1)).getBaseURL());
-      AsyncUpdateWithRandomCommit task = new AsyncUpdateWithRandomCommit(update, NONLEADERS.get(0), seed);
+      AsyncUpdateWithRandomCommit task = new AsyncUpdateWithRandomCommit(update, NONLEADERS.get(0),
+                                                                         random().nextLong());
       updateResponses.add(threadpool.submit(task));
       // while we can't guarantee/trust what order the updates are executed in, since multiple threads
       // are involved, but we're trying to bias the thread scheduling to run them in the order submitted
@@ -736,11 +735,11 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
     shardToJetty.get(SHARD1).get(1).jetty.getDebugFilter().addDelay(
         "Waiting for dependant update to timeout", 1, 6000);
 
-    long seed = random().nextLong(); // seed for randomization within the threads
     ExecutorService threadpool =
         ExecutorUtil.newMDCAwareFixedThreadPool(updates.size() + 1, new DefaultSolrThreadFactory(getTestName()));
     for (UpdateRequest update : updates) {
-      AsyncUpdateWithRandomCommit task = new AsyncUpdateWithRandomCommit(update, cloudClient, seed);
+      AsyncUpdateWithRandomCommit task = new AsyncUpdateWithRandomCommit(update, cloudClient,
+                                                                         random().nextLong());
       threadpool.submit(task);
 
       // while we can't guarantee/trust what order the updates are executed in, since multiple threads
@@ -794,7 +793,8 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
       threadpool =
           ExecutorUtil.newMDCAwareFixedThreadPool(updates.size() + 1, new DefaultSolrThreadFactory(getTestName()));
       for (UpdateRequest update : updates) {
-        AsyncUpdateWithRandomCommit task = new AsyncUpdateWithRandomCommit(update, cloudClient, seed);
+        AsyncUpdateWithRandomCommit task = new AsyncUpdateWithRandomCommit(update, cloudClient,
+                                                                           random().nextLong());
         threadpool.submit(task);
         
         // while we can't guarantee/trust what order the updates are executed in, since multiple threads
@@ -1048,7 +1048,8 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {
     ExecutorService threadpool =
         ExecutorUtil.newMDCAwareFixedThreadPool(updates.size() + 1, new DefaultSolrThreadFactory(getTestName()));
     for (UpdateRequest update : updates) {
-      AsyncUpdateWithRandomCommit task = new AsyncUpdateWithRandomCommit(update, cloudClient, seed);
+      AsyncUpdateWithRandomCommit task = new AsyncUpdateWithRandomCommit(update, cloudClient,
+                                                                         random().nextLong());
       threadpool.submit(task);
 
       // while we can't guarantee/trust what order the updates are executed in, since multiple threads