From ee45e83439a69e67037413304c32e3caf0bfb1d2 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Thu, 5 May 2016 16:02:27 +0530 Subject: [PATCH] SOLR-9030: Added a code comment as to why we use Integer.MAX_VALUE instead of -1 (cherry picked from commit 827573b1a7bda2ae853f03c518f313e5992c1a7c) --- .../src/java/org/apache/solr/common/cloud/DocCollection.java | 1 + 1 file changed, 1 insertion(+) 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 590c15546a8..d30a73fa145 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 slices, Map 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;