SOLR-5608: Unregister core from cloud state after closing in unload.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1555685 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2014-01-06 06:15:15 +00:00
parent 5dfb49986e
commit 2970e46163
1 changed files with 17 additions and 17 deletions

View File

@ -597,28 +597,11 @@ public class CoreAdminHandler extends RequestHandlerBase {
} else {
if (coreContainer.getZkController() != null) {
// we are unloading, cancel any ongoing recovery
// so there are no races to publish state
// we will try to cancel again later before close
if (core != null) {
if (coreContainer.getZkController() != null) {
core.getSolrCoreState().cancelRecovery();
}
}
log.info("Unregistering core " + core.getName() + " from cloudstate.");
try {
coreContainer.getZkController().unregister(cname,
core.getCoreDescriptor());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Could not unregister core " + cname + " from cloudstate: "
+ e.getMessage(), e);
} catch (KeeperException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Could not unregister core " + cname + " from cloudstate: "
+ e.getMessage(), e);
}
}
if (params.getBool(CoreAdminParams.DELETE_INDEX, false)) {
@ -672,6 +655,23 @@ public class CoreAdminHandler extends RequestHandlerBase {
if (closeCore) {
core.close();
}
if (coreContainer.getZkController() != null) {
log.info("Unregistering core " + core.getName() + " from cloudstate.");
try {
coreContainer.getZkController().unregister(cname,
core.getCoreDescriptor());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Could not unregister core " + cname + " from cloudstate: "
+ e.getMessage(), e);
} catch (KeeperException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Could not unregister core " + cname + " from cloudstate: "
+ e.getMessage(), e);
}
}
}
}