lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dragonsi...@apache.org
Subject lucene-solr:master: SOLR-10524: Build fix for NPE
Date Tue, 09 May 2017 00:34:05 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 6f978c587 -> 972e342fe


SOLR-10524: Build fix for NPE

Introduced by ZkStateWriter batching optimizations.


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

Branch: refs/heads/master
Commit: 972e342fee7a02e71300a9739b9971e63708589b
Parents: 6f978c5
Author: Scott Blum <dragonsinth@apache.org>
Authored: Mon May 8 20:32:38 2017 -0400
Committer: Scott Blum <dragonsinth@apache.org>
Committed: Mon May 8 20:33:55 2017 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                          |  2 +-
 .../org/apache/solr/cloud/overseer/ZkStateWriter.java     |  3 +++
 .../org/apache/solr/cloud/overseer/ZkStateWriterTest.java | 10 +++++-----
 3 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/972e342f/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index de3ce0b..cdbbcc8 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -256,7 +256,7 @@ Optimizations
 * SOLR-10548: JSON Facet API now uses hyper-log-log++ for determining the number of buckets
   when merging requests from a multi-shard distributed request. (yonik)
 
-* SOLR-10524: Explore in-memory partitioning for processing Overseer queue messages (Cao
Manh Dat, Noble Paul, shalin, Scott Blum)
+* SOLR-10524: Better ZkStateWriter batching (Cao Manh Dat, Noble Paul, shalin, Scott Blum)
 
 Bug Fixes
 ----------------------

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/972e342f/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
index 48d2ecb..da0f57c 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
@@ -166,6 +166,9 @@ public class ZkStateWriter {
    * @return true if a flush is required, false otherwise
    */
   protected boolean maybeFlushBefore(ZkWriteCommand cmd) {
+    if (cmd.collection == null || lastStateFormat <= 0) {
+      return false;
+    }
     return cmd.collection.getStateFormat() != lastStateFormat;
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/972e342f/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java
index 85dbf4a..f96b5e2 100644
--- a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java
@@ -77,7 +77,7 @@ public class ZkStateWriterTest extends SolrTestCaseJ4 {
 
         ZkWriteCommand c2 = new ZkWriteCommand("c2",
             new DocCollection("c2", new HashMap<>(), new HashMap<>(), DocRouter.DEFAULT,
0, ZkStateReader.COLLECTIONS_ZKNODE + "/c2"));
-        assertTrue("Different (new) collection create cannot be batched together with another
create", writer.maybeFlushBefore(c2));
+        assertFalse("Different (new) collection create can be batched together with another
create", writer.maybeFlushBefore(c2));
 
         // simulate three state changes on same collection, all should be batched together
before
         assertFalse(writer.maybeFlushBefore(c1));
@@ -88,13 +88,13 @@ public class ZkStateWriterTest extends SolrTestCaseJ4 {
         assertFalse(writer.maybeFlushAfter(c1));
         assertFalse(writer.maybeFlushAfter(c1));
 
-        // simulate three state changes on two different collections with stateFormat=2,
none should be batched
+        // simulate three state changes on two different collections with stateFormat=2,
all should be batched
         assertFalse(writer.maybeFlushBefore(c1));
         // flushAfter has to be called as it updates the internal batching related info
         assertFalse(writer.maybeFlushAfter(c1));
-        assertTrue(writer.maybeFlushBefore(c2));
+        assertFalse(writer.maybeFlushBefore(c2));
         assertFalse(writer.maybeFlushAfter(c2));
-        assertTrue(writer.maybeFlushBefore(c1));
+        assertFalse(writer.maybeFlushBefore(c1));
         assertFalse(writer.maybeFlushAfter(c1));
 
         // create a collection in stateFormat = 1 i.e. inside the main cluster state
@@ -168,7 +168,7 @@ public class ZkStateWriterTest extends SolrTestCaseJ4 {
     }
   }
 
-  public void testSingleExternalCollection() throws Exception{
+  public void testSingleExternalCollection() throws Exception {
     String zkDir = createTempDir("testSingleExternalCollection").toFile().getAbsolutePath();
 
     ZkTestServer server = new ZkTestServer(zkDir);


Mime
View raw message