From 2e0eea734676195e1a9a35f70c6d29bf48733545 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Mon, 3 Nov 2014 17:30:04 +0000 Subject: [PATCH] SOLR-6591: Ignore overseer operations for collections with stateFormat > 1 if the parent ZK path doesn't exist git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1636400 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/java/org/apache/solr/cloud/Overseer.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java index 2a9b00fe8bd..3d8c9262f4d 100644 --- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java +++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java @@ -382,6 +382,20 @@ public class Overseer implements Closeable { zkClient.setData(e.getKey(), data, true); } else { log.info("going to create_collection {}", e.getKey()); + String parentPath = e.getKey().substring(0, e.getKey().lastIndexOf('/')); + if (!zkClient.exists(parentPath, true)) { + // if the /collections/collection_name path doesn't exist then it means that + // 1) the user invoked a DELETE collection API and the OverseerCollectionProcessor has deleted + // this zk path. + // 2) these are most likely old "state" messages which are only being processed now because + // if they were new "state" messages then in legacy mode, a new collection would have been + // created with stateFormat = 1 (which is the default state format) + // 3) these can't be new "state" messages created for a new collection because + // otherwise the OverseerCollectionProcessor would have already created this path + // as part of the create collection API call -- which is the only way in which a collection + // with stateFormat > 1 can possibly be created + continue; + } zkClient.create(e.getKey(), data, CreateMode.PERSISTENT, true); } }