You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/06/17 20:59:05 UTC

[2/2] lucene-solr:branch_5x: SOLR-9030: Added a code comment as to why we use Integer.MAX_VALUE instead of -1

SOLR-9030: Added a code comment as to why we use Integer.MAX_VALUE instead of -1

(cherry picked from commit 827573b1a7bda2ae853f03c518f313e5992c1a7c)


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

Branch: refs/heads/branch_5x
Commit: 394822de751f93cd39d01f26b352f299193ee31c
Parents: e62e6c4
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Thu May 5 16:02:27 2016 +0530
Committer: Steve Rowe <sa...@apache.org>
Committed: Fri Jun 17 16:58:55 2016 -0400

----------------------------------------------------------------------
 solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/394822de/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 08737e8..4acebb9 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
@@ -66,6 +66,7 @@ public class DocCollection extends ZkNodeProps {
    */
   public DocCollection(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router, int zkVersion, String znode) {
     super(props==null ? props = new HashMap<>() : props);
+    // -1 means any version in ZK CAS, so we choose Integer.MAX_VALUE instead to avoid accidental overwrites
     this.znodeVersion = zkVersion == -1 ? Integer.MAX_VALUE : zkVersion;
     this.name = name;