mirror of https://github.com/apache/lucene.git
somehow didn't make it in the previous commit
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1245213 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9897a0e792
commit
8a2bc76e2f
|
@ -354,6 +354,10 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
||||||
if (opts != null)
|
if (opts != null)
|
||||||
cd.setShardId(opts);
|
cd.setShardId(opts);
|
||||||
|
|
||||||
|
opts = params.get(CoreAdminParams.ROLES);
|
||||||
|
if (opts != null)
|
||||||
|
cd.setRoles(opts);
|
||||||
|
|
||||||
Integer numShards = params.getInt(ZkStateReader.NUM_SHARDS_PROP);
|
Integer numShards = params.getInt(ZkStateReader.NUM_SHARDS_PROP);
|
||||||
if (numShards != null)
|
if (numShards != null)
|
||||||
cd.setNumShards(numShards);
|
cd.setNumShards(numShards);
|
||||||
|
@ -401,14 +405,10 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
||||||
boolean doPersist = false;
|
boolean doPersist = false;
|
||||||
|
|
||||||
if (cname.equals(name)) return doPersist;
|
if (cname.equals(name)) return doPersist;
|
||||||
|
|
||||||
SolrCore core = coreContainer.getCore(cname);
|
doPersist = coreContainer.isPersistent();
|
||||||
if (core != null) {
|
coreContainer.rename(cname, name);
|
||||||
doPersist = coreContainer.isPersistent();
|
|
||||||
coreContainer.register(name, core, false);
|
|
||||||
coreContainer.remove(cname);
|
|
||||||
core.close();
|
|
||||||
}
|
|
||||||
return doPersist;
|
return doPersist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +601,11 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
||||||
SolrCore core = null;
|
SolrCore core = null;
|
||||||
try {
|
try {
|
||||||
core = coreContainer.getCore(cname);
|
core = coreContainer.getCore(cname);
|
||||||
core.getUpdateHandler().getSolrCoreState().doRecovery(core);
|
if (core != null) {
|
||||||
|
core.getUpdateHandler().getSolrCoreState().doRecovery(core);
|
||||||
|
} else {
|
||||||
|
SolrException.log(log, "Cound not find core to call recovery:" + cname);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// no recoveryStrat close for now
|
// no recoveryStrat close for now
|
||||||
if (core != null) {
|
if (core != null) {
|
||||||
|
@ -630,7 +634,7 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
||||||
if (core == null) {
|
if (core == null) {
|
||||||
throw new SolrException(ErrorCode.BAD_REQUEST, "core not found:" + cname);
|
throw new SolrException(ErrorCode.BAD_REQUEST, "core not found:" + cname);
|
||||||
}
|
}
|
||||||
String state;
|
String state = null;
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
// wait until we are sure the recovering node is ready
|
// wait until we are sure the recovering node is ready
|
||||||
|
@ -640,14 +644,19 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
||||||
CloudState cloudState = coreContainer
|
CloudState cloudState = coreContainer
|
||||||
.getZkController()
|
.getZkController()
|
||||||
.getCloudState();
|
.getCloudState();
|
||||||
|
String collection = cloudDescriptor.getCollectionName();
|
||||||
ZkNodeProps nodeProps =
|
ZkNodeProps nodeProps =
|
||||||
cloudState.getSlice(cloudDescriptor.getCollectionName(),
|
cloudState.getSlice(collection,
|
||||||
cloudDescriptor.getShardId()).getShards().get(coreNodeName);
|
cloudDescriptor.getShardId()).getShards().get(coreNodeName);
|
||||||
state = nodeProps.get(ZkStateReader.STATE_PROP);
|
boolean live = false;
|
||||||
boolean live = cloudState.liveNodesContain(nodeName);
|
if (nodeProps != null) {
|
||||||
if (nodeProps != null && state.equals(ZkStateReader.RECOVERING)
|
|
||||||
&& live) {
|
state = nodeProps.get(ZkStateReader.STATE_PROP);
|
||||||
break;
|
live = cloudState.liveNodesContain(nodeName);
|
||||||
|
if (nodeProps != null && state.equals(ZkStateReader.RECOVERING)
|
||||||
|
&& live) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry++ == 30) {
|
if (retry++ == 30) {
|
||||||
|
|
Loading…
Reference in New Issue