You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2016/02/11 17:42:58 UTC

[24/31] lucene-solr git commit: fix test failure when primary is flushing just before crashing

fix test failure when primary is flushing just before crashing


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

Branch: refs/heads/master
Commit: e7351d34050b4b5cdaf4b85ec9260ddfd3af9dda
Parents: 9afa560
Author: Mike McCandless <mi...@apache.org>
Authored: Mon Feb 8 19:18:22 2016 -0500
Committer: Mike McCandless <mi...@apache.org>
Committed: Mon Feb 8 19:18:22 2016 -0500

----------------------------------------------------------------------
 .../lucene/replicator/nrt/TestStressNRTReplication.java   | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7351d34/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java
----------------------------------------------------------------------
diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java
index 28b15f8..f259580 100644
--- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java
+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java
@@ -785,7 +785,7 @@ public class TestStressNRTReplication extends LuceneTestCase {
       try {
         while (stop.get() == false) {
           Thread.sleep(TestUtil.nextInt(random(), 50, 500));
-          message("top: restarter cycle");
+          //message("top: restarter cycle");
 
           // Randomly crash full cluster:
           if (DO_FULL_CLUSTER_CRASH && random().nextInt(500) == 17) {
@@ -921,6 +921,8 @@ public class TestStressNRTReplication extends LuceneTestCase {
           continue;
         }
 
+        boolean nodeIsPrimary = node == primary;
+
         try {
 
           Thread.currentThread().setName("Searcher node=" + node);
@@ -970,6 +972,12 @@ public class TestStressNRTReplication extends LuceneTestCase {
             if (oldHitCount == null) {
               hitCounts.put(version, hitCount);
               message("top: searcher: record search hitCount version=" + version + " hitCount=" + hitCount + " node=" + node);
+              if (nodeIsPrimary && version > lastPrimaryVersion) {
+                // It's possible a search request sees a new primary version because it's in the process of flushing, but then the primary
+                // crashes.  In this case we need to ensure new primary forces its version beyond this:
+                message("top: searcher: set lastPrimaryVersion=" + lastPrimaryVersion + " vs " + version);
+                lastPrimaryVersion = version;
+              }
             } else {
               // Just ensure that all nodes show the same hit count for
               // the same version, i.e. they really are replicas of one another: