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:56 UTC

[22/31] lucene-solr git commit: indexer threads should stop on shutdown; don't suppress exceptions; decrease random commit frequency

indexer threads should stop on shutdown; don't suppress exceptions; decrease random commit frequency


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

Branch: refs/heads/master
Commit: ae2b58c03c82b6faedc35698542f4898892683b2
Parents: 30613c7
Author: Mike McCandless <mi...@apache.org>
Authored: Mon Feb 8 19:15:17 2016 -0500
Committer: Mike McCandless <mi...@apache.org>
Committed: Mon Feb 8 19:15:17 2016 -0500

----------------------------------------------------------------------
 .../lucene/replicator/nrt/SimplePrimaryNode.java | 19 ++++++++++++++-----
 .../lucene/replicator/nrt/SimpleServer.java      |  3 ++-
 .../replicator/nrt/TestStressNRTReplication.java |  7 ++++---
 3 files changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ae2b58c0/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimplePrimaryNode.java
----------------------------------------------------------------------
diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimplePrimaryNode.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimplePrimaryNode.java
index fe14234..d3415ad 100644
--- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimplePrimaryNode.java
+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimplePrimaryNode.java
@@ -163,7 +163,7 @@ class SimplePrimaryNode extends PrimaryNode {
       return;
     }
 
-    message("top: warm merge " + info + " to " + replicaTCPPorts.length + " replicas: files=" + files.keySet());
+    message("top: warm merge " + info + " to " + replicaTCPPorts.length + " replicas; tcpPort=" + tcpPort + ": files=" + files.keySet());
 
     MergePreCopy preCopy = new MergePreCopy(files);
     warmingSegments.add(preCopy);
@@ -289,8 +289,8 @@ class SimplePrimaryNode extends PrimaryNode {
       // Something did get flushed (there were indexing ops since the last flush):
 
       verifyAtLeastMarkerCount(atLeastMarkerCount, null);
-
-      // Tell caller the version before pushing to replicas, so that even if we crash after this, caller will know what version we
+ 
+     // Tell caller the version before pushing to replicas, so that even if we crash after this, caller will know what version we
       // (possibly) pushed to some replicas.  Alternatively we could make this 2 separate ops?
       long version = getCopyStateVersion();
       message("send flushed version=" + version);
@@ -432,10 +432,19 @@ class SimplePrimaryNode extends PrimaryNode {
     tokenizedWithTermVectors.setStoreTermVectorPositions(true);
   }
 
-  private void handleIndexing(Socket socket, DataInput in, DataOutput out, BufferedOutputStream bos) throws IOException {
+  private void handleIndexing(Socket socket, AtomicBoolean stop, InputStream is, DataInput in, DataOutput out, BufferedOutputStream bos) throws IOException, InterruptedException {
     Thread.currentThread().setName("indexing");
     message("start handling indexing socket=" + socket);
     while (true) {
+      while (true) {
+        if (is.available() > 0) {
+          break;
+        }
+        if (stop.get()) {
+          return;
+        }
+        Thread.sleep(10);
+      }
       byte cmd;
       try {
         cmd = in.readByte();
@@ -587,7 +596,7 @@ class SimplePrimaryNode extends PrimaryNode {
         break;
 
       case CMD_INDEXING:
-        handleIndexing(socket, in, out, bos);
+        handleIndexing(socket, stop, is, in, out, bos);
         break;
 
       case CMD_GET_SEARCHING_VERSION:

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ae2b58c0/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java
----------------------------------------------------------------------
diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java
index 72e33d7..3bad39b 100644
--- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java
+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java
@@ -106,7 +106,8 @@ public class SimpleServer extends LuceneTestCase {
           // Test should fail with this:
           throw new RuntimeException(t);
         } else {
-          node.message("exception " + t + " handling client connection; ignoring");
+          node.message("exception handling client connection; ignoring:");
+          t.printStackTrace(System.out);
         }
       } finally {
         if (success) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ae2b58c0/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..86550c5 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
@@ -155,7 +155,7 @@ public class TestStressNRTReplication extends LuceneTestCase {
   static final boolean DO_BIT_FLIPS_DURING_COPY = true;
 
   /** Set to a non-null value to force exactly that many nodes; else, it's random. */
-  static final Integer NUM_NODES = null;
+  static final Integer NUM_NODES;
 
   final AtomicBoolean failed = new AtomicBoolean();
 
@@ -321,7 +321,7 @@ public class TestStressNRTReplication extends LuceneTestCase {
 
       // Commit a random node, primary or replica
 
-      {
+      if (random().nextInt(10) == 1) {
         NodeProcess node = nodes[random().nextInt(nodes.length)];
         if (node != null && node.nodeIsClosing.get() == false) {
           // TODO: if this node is primary, it means we committed an unpublished version (not exposed as an NRT point)... not sure it matters.
@@ -751,7 +751,8 @@ public class TestStressNRTReplication extends LuceneTestCase {
         c.flush();
         c.in.readByte();
       } catch (Throwable t) {
-        message("top: ignore exc sending replicas to primary: " + t);
+        message("top: ignore exc sending replicas to primary P" + curPrimary.id + " at tcpPort=" + curPrimary.tcpPort);
+        t.printStackTrace(System.out);
       }
     }
   }