diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c28de06327b..b1b650c9728 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -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 ---------------------- diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java index c32019bf6ac..40c11fbe16b 100644 --- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java +++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java @@ -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> shardEntries = shards.entrySet(); for (Map.Entry 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);