mirror of https://github.com/apache/lucene.git
SOLR-11478: Solr should remove itself from live_nodes in zk immediately on shutdown
This commit is contained in:
parent
283ffef9e2
commit
57e976341b
|
@ -61,6 +61,10 @@ Optimizations
|
|||
|
||||
* SOLR-11443: Remove the usage of workqueue for Overseer. (Cao Manh Dat, Scott Blum)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
* SOLR-11478: Solr should remove itself from live_nodes in zk immediately on shutdown. (Cao Manh Dat)
|
||||
|
||||
================== 7.1.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -976,6 +976,20 @@ public class ZkController {
|
|||
zkClient.multi(ops, true);
|
||||
}
|
||||
|
||||
public void removeEphemeralLiveNode() throws KeeperException, InterruptedException {
|
||||
if (zkRunOnly) {
|
||||
return;
|
||||
}
|
||||
String nodeName = getNodeName();
|
||||
String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName;
|
||||
String nodeAddedPath = ZkStateReader.SOLR_AUTOSCALING_NODE_ADDED_PATH + "/" + nodeName;
|
||||
log.info("Remove node as live in ZooKeeper:" + nodePath);
|
||||
List<Op> ops = new ArrayList<>(2);
|
||||
ops.add(Op.delete(nodePath, -1));
|
||||
ops.add(Op.delete(nodeAddedPath, -1));
|
||||
zkClient.multi(ops, true);
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
|
|
@ -747,6 +747,11 @@ public class CoreContainer {
|
|||
if (isZooKeeperAware()) {
|
||||
cancelCoreRecoveries();
|
||||
zkSys.zkController.publishNodeAsDown(zkSys.zkController.getNodeName());
|
||||
try {
|
||||
zkSys.zkController.removeEphemeralLiveNode();
|
||||
} catch (Exception e) {
|
||||
log.warn("Error removing live node. Continuing to close CoreContainer", e);
|
||||
}
|
||||
if (metricManager != null) {
|
||||
metricManager.closeReporters(SolrMetricManager.getRegistryName(SolrInfoBean.Group.cluster));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue