mirror of https://github.com/apache/lucene.git
SOLR-5587: ElectionContext implementations should use ZkCmdExecutor#ensureExists to ensure their election paths are properly created.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1554113 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e08106c568
commit
f0944d6b06
|
@ -321,6 +321,10 @@ Bug Fixes
|
|||
* SOLR-5586: All ZkCmdExecutor's should be initialized with the zk client
|
||||
timeout. (Mark Miller)
|
||||
|
||||
* SOLR-5587: ElectionContext implementations should use
|
||||
ZkCmdExecutor#ensureExists to ensure their election paths are properly
|
||||
created. (Mark Miller)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.apache.solr.common.cloud.ClusterState;
|
|||
import org.apache.solr.common.cloud.Replica;
|
||||
import org.apache.solr.common.cloud.Slice;
|
||||
import org.apache.solr.common.cloud.SolrZkClient;
|
||||
import org.apache.solr.common.cloud.ZkCmdExecutor;
|
||||
import org.apache.solr.common.cloud.ZkCoreNodeProps;
|
||||
import org.apache.solr.common.cloud.ZkNodeProps;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
|
@ -93,6 +94,15 @@ class ShardLeaderElectionContextBase extends ElectionContext {
|
|||
this.zkClient = zkStateReader.getZkClient();
|
||||
this.shardId = shardId;
|
||||
this.collection = collection;
|
||||
|
||||
try {
|
||||
new ZkCmdExecutor(zkStateReader.getZkClient().getZkClientTimeout()).ensureExists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection, zkClient);
|
||||
} catch (KeeperException e) {
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -424,6 +434,14 @@ final class OverseerElectionContext extends ElectionContext {
|
|||
super(zkNodeName, "/overseer_elect", "/overseer_elect/leader", null, zkClient);
|
||||
this.overseer = overseer;
|
||||
this.zkClient = zkClient;
|
||||
try {
|
||||
new ZkCmdExecutor(zkClient.getZkClientTimeout()).ensureExists("/overseer_elect", zkClient);
|
||||
} catch (KeeperException e) {
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue