SOLR-5608: Don't allow a closed SolrCore to publish state to ZooKeeper.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1555659 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2014-01-06 04:37:48 +00:00
parent 50e277c1ef
commit 5dfb49986e
2 changed files with 22 additions and 2 deletions

View File

@ -341,6 +341,9 @@ Bug Fixes
* SOLR-5564: hl.maxAlternateFieldLength should apply to original field when * SOLR-5564: hl.maxAlternateFieldLength should apply to original field when
fallback is attempted (janhoy) fallback is attempted (janhoy)
* SOLR-5608: Don't allow a closed SolrCore to publish state to ZooKeeper.
(Mark Miller, Shawn Heisey)
Optimizations Optimizations
---------------------- ----------------------

View File

@ -982,10 +982,27 @@ public final class ZkController {
publish(cd, state, true); publish(cd, state, true);
} }
public void publish(final CoreDescriptor cd, final String state, boolean updateLastState) throws KeeperException, InterruptedException {
publish(cd, state, true, false);
}
/** /**
* Publish core state to overseer. * Publish core state to overseer.
*/ */
public void publish(final CoreDescriptor cd, final String state, boolean updateLastState) throws KeeperException, InterruptedException { public void publish(final CoreDescriptor cd, final String state, boolean updateLastState, boolean forcePublish) throws KeeperException, InterruptedException {
if (!forcePublish) {
SolrCore core = cc.getCore(cd.getName());
if (core == null) {
return;
}
try {
if (core.isClosed()) {
return;
}
} finally {
core.close();
}
}
log.info("publishing core={} state={}", cd.getName(), state); log.info("publishing core={} state={}", cd.getName(), state);
//System.out.println(Thread.currentThread().getStackTrace()[3]); //System.out.println(Thread.currentThread().getStackTrace()[3]);
Integer numShards = cd.getCloudDescriptor().getNumShards(); Integer numShards = cd.getCloudDescriptor().getNumShards();
@ -1341,7 +1358,7 @@ public final class ZkController {
cloudDesc.setCoreNodeName(coreNodeName); cloudDesc.setCoreNodeName(coreNodeName);
} }
publish(cd, ZkStateReader.DOWN, false); publish(cd, ZkStateReader.DOWN, false, true);
} catch (KeeperException e) { } catch (KeeperException e) {
log.error("", e); log.error("", e);
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e); throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e);