SOLR-9846: Overseer is not always closed after being started.

This commit is contained in:
markrmiller 2017-02-17 11:29:19 -05:00
parent 6b169d2051
commit ed05debb4e
4 changed files with 12 additions and 5 deletions

View File

@ -165,6 +165,7 @@ Bug Fixes
* SOLR-10141: Upgrade to Caffeine 2.3.5 since v1.0.1 contributed to BlockCache corruption because the
removal listener was called more than once for some items and not at all for other items. (Ben Manes, yonik)
* SOLR-9846: Overseer is not always closed after being started. (Mark Miller)
Optimizations
----------------------

View File

@ -484,6 +484,7 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
public void checkLIR(String coreName, boolean allReplicasInLine)
throws InterruptedException, KeeperException, IOException {
if (allReplicasInLine) {
log.info("Found all replicas participating in election, clear LIR");
// SOLR-8075: A bug may allow the proper leader to get marked as LIR DOWN and
// if we are marked as DOWN but were able to become the leader, we remove
// the DOWN entry here so that we don't fail publishing ACTIVE due to being in LIR.
@ -752,6 +753,11 @@ final class OverseerElectionContext extends ElectionContext {
super.cancelElection();
overseer.close();
}
@Override
public void close() {
overseer.close();
}
@Override
public ElectionContext copy() {

View File

@ -388,6 +388,7 @@ public class LeaderElector {
}
if (watcher != null) watcher.cancel();
this.context.cancelElection();
this.context.close();
this.context = ctx;
joinElection(ctx, true, joinAtHead);
}

View File

@ -75,6 +75,7 @@ import org.apache.solr.common.cloud.ZooKeeperException;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.IOUtils;
import org.apache.solr.common.util.ObjectReleaseTracker;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.common.util.URLUtil;
@ -324,6 +325,7 @@ public class ZkController {
ElectionContext prevContext = overseerElector.getContext();
if (prevContext != null) {
prevContext.cancelElection();
prevContext.close();
}
overseerElector.setup(context);
@ -534,11 +536,8 @@ public class ZkController {
}
} finally {
try {
try {
overseer.close();
} catch (Exception e) {
log.error("Error closing overseer", e);
}
IOUtils.closeQuietly(overseerElector.getContext());
IOUtils.closeQuietly(overseer);
} finally {
try {
try {