SOLR-4609: The Collections API should only send the reload command to ACTIVE cores.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1457864 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-03-18 17:03:42 +00:00
parent 471d7e9971
commit 12c2d46446
2 changed files with 7 additions and 4 deletions

View File

@ -161,6 +161,9 @@ Bug Fixes
* SOLR-4605: Rollback does not work correctly. (Mark S, Mark Miller)
* SOLR-4609: The Collections API should only send the reload command to ACTIVE
cores. (Mark Miller)
Optimizations
----------------------

View File

@ -162,11 +162,11 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(CoreAdminParams.ACTION, CoreAdminAction.UNLOAD.toString());
params.set(CoreAdminParams.DELETE_INSTANCE_DIR, true);
collectionCmd(zkStateReader.getClusterState(), message, params, results);
collectionCmd(zkStateReader.getClusterState(), message, params, results, null);
} else if (RELOADCOLLECTION.equals(operation)) {
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(CoreAdminParams.ACTION, CoreAdminAction.RELOAD.toString());
collectionCmd(zkStateReader.getClusterState(), message, params, results);
collectionCmd(zkStateReader.getClusterState(), message, params, results, ZkStateReader.ACTIVE);
} else if (CREATEALIAS.equals(operation)) {
createAlias(zkStateReader.getAliases(), message);
} else if (DELETEALIAS.equals(operation)) {
@ -432,7 +432,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
}
}
private void collectionCmd(ClusterState clusterState, ZkNodeProps message, ModifiableSolrParams params, NamedList results) {
private void collectionCmd(ClusterState clusterState, ZkNodeProps message, ModifiableSolrParams params, NamedList results, String stateMatcher) {
log.info("Executing Collection Cmd : " + params);
String collectionName = message.getStr("name");
@ -449,7 +449,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
Set<Map.Entry<String,Replica>> shardEntries = shards.entrySet();
for (Map.Entry<String,Replica> shardEntry : shardEntries) {
final ZkNodeProps node = shardEntry.getValue();
if (clusterState.liveNodesContain(node.getStr(ZkStateReader.NODE_NAME_PROP))) {
if (clusterState.liveNodesContain(node.getStr(ZkStateReader.NODE_NAME_PROP)) && (stateMatcher != null ? node.getStr(ZkStateReader.STATE_PROP).equals(stateMatcher) : true)) {
// For thread safety, only simple clone the ModifiableSolrParams
ModifiableSolrParams cloneParams = new ModifiableSolrParams();
cloneParams.add(params);