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
This commit is contained in:
Shalin Shekhar Mangar 2014-11-03 17:30:04 +00:00
parent 06510acbab
commit 2e0eea7346
1 changed files with 14 additions and 0 deletions

View File

@ -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);
}
}