lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject [2/2] lucene-solr:branch_5x: SOLR-9030: The 'downnode' overseer command can trip asserts in ZkStateWriter (cherry picked from commit c2662f2)
Date Fri, 17 Jun 2016 20:57:20 GMT
SOLR-9030: The 'downnode' overseer command can trip asserts in ZkStateWriter
(cherry picked from commit c2662f2)


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

Branch: refs/heads/branch_5x
Commit: e62e6c4b79cfe297d1b34c26bd1911ec5d448ca4
Parents: ea9120e
Author: Shalin Shekhar Mangar <shalin@apache.org>
Authored: Thu May 5 05:16:39 2016 +0530
Committer: Steve Rowe <sarowe@apache.org>
Committed: Fri Jun 17 16:57:07 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/solr/cloud/overseer/ZkStateWriter.java  | 2 +-
 .../java/org/apache/solr/common/cloud/DocCollection.java    | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e62e6c4b/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 ec67ed7..d53d366 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
@@ -227,8 +227,8 @@ public class ZkStateWriter {
           } else if (c.getStateFormat() > 1) {
             byte[] data = Utils.toJSON(singletonMap(c.getName(), c));
             if (reader.getZkClient().exists(path, true)) {
-              assert c.getZNodeVersion() >= 0;
               log.info("going to update_collection {} version: {}", path, c.getZNodeVersion());
+              assert c.getZNodeVersion() >= 0;
               Stat stat = reader.getZkClient().setData(path, data, c.getZNodeVersion(), true);
               DocCollection newCollection = new DocCollection(name, c.getSlicesMap(), c.getProperties(),
c.getRouter(), stat.getVersion(), path);
               clusterState = clusterState.copyWith(name, newCollection);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e62e6c4b/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java b/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
index e8f26e1..08737e8 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
@@ -41,7 +41,8 @@ public class DocCollection extends ZkNodeProps {
   public static final String STATE_FORMAT = "stateFormat";
   public static final String RULE = "rule";
   public static final String SNITCH = "snitch";
-  private int znodeVersion = -1; // sentinel
+
+  private final int znodeVersion;
 
   private final String name;
   private final Map<String, Slice> slices;
@@ -55,7 +56,7 @@ public class DocCollection extends ZkNodeProps {
 
 
   public DocCollection(String name, Map<String, Slice> slices, Map<String, Object>
props, DocRouter router) {
-    this(name, slices, props, router, -1, ZkStateReader.CLUSTER_STATE);
+    this(name, slices, props, router, Integer.MAX_VALUE, ZkStateReader.CLUSTER_STATE);
   }
 
   /**
@@ -64,8 +65,8 @@ public class DocCollection extends ZkNodeProps {
    * @param props  The properties of the slice.  This is used directly and a copy is not
made.
    */
   public DocCollection(String name, Map<String, Slice> slices, Map<String, Object>
props, DocRouter router, int zkVersion, String znode) {
-    super(props==null ? props = new HashMap<String,Object>() : props);
-    this.znodeVersion = zkVersion;
+    super(props==null ? props = new HashMap<>() : props);
+    this.znodeVersion = zkVersion == -1 ? Integer.MAX_VALUE : zkVersion;
     this.name = name;
 
     this.slices = slices;


Mime
View raw message