SOLR-10196: ElectionContext#runLeaderProcess can hit NPE on core close.

This commit is contained in:
markrmiller 2017-02-27 23:41:30 -05:00
parent ed0f0f45ce
commit 04ba9968c0
3 changed files with 9 additions and 3 deletions

View File

@ -186,6 +186,8 @@ Bug Fixes
* SOLR-10055: Linux installer now renames existing bin/solr.in.* as bin/solr.in.*.orig to make the installed config in * SOLR-10055: Linux installer now renames existing bin/solr.in.* as bin/solr.in.*.orig to make the installed config in
/etc/defaults be the one found by default when launching solr manually. (janhoy) /etc/defaults be the one found by default when launching solr manually. (janhoy)
* SOLR-10196: ElectionContext#runLeaderProcess can hit NPE on core close. (Mark Miller)
Optimizations Optimizations
---------------------- ----------------------

View File

@ -423,8 +423,12 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
super.runLeaderProcess(weAreReplacement, 0); super.runLeaderProcess(weAreReplacement, 0);
try (SolrCore core = cc.getCore(coreName)) { try (SolrCore core = cc.getCore(coreName)) {
if (core != null) {
core.getCoreDescriptor().getCloudDescriptor().setLeader(true); core.getCoreDescriptor().getCloudDescriptor().setLeader(true);
publishActiveIfRegisteredAndNotActive(core); publishActiveIfRegisteredAndNotActive(core);
} else {
return;
}
} }
log.info("I am the new leader: " + ZkCoreNodeProps.getCoreUrl(leaderProps) + " " + shardId); log.info("I am the new leader: " + ZkCoreNodeProps.getCoreUrl(leaderProps) + " " + shardId);

View File

@ -47,7 +47,7 @@ public class CleanupOldIndexTest extends SolrCloudTestCase {
} }
@AfterClass @AfterClass
public static void teardownTestCases() throws Exception { public static void afterClass() throws Exception {
if (suiteFailureMarker.wasSuccessful()) { if (suiteFailureMarker.wasSuccessful()) {
zkClient().printLayoutToStdOut(); zkClient().printLayoutToStdOut();