SOLR-6923: AutoAddReplicas also consults live_nodes to see if a state change has happened

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1651221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2015-01-12 22:53:38 +00:00
parent 847f870e75
commit 68cf1ca825
2 changed files with 9 additions and 2 deletions

View File

@ -427,6 +427,9 @@ Bug Fixes
* SOLR-6946: Document -p port option for the create_core and create_collection actions in
bin/solr (Timothy Potter)
* SOLR-6923: AutoAddReplicas also consults live_nodes to see if a state change has happened.
(Varun Thacker via Anshum Gupta)
Optimizations
----------------------

View File

@ -20,6 +20,7 @@ package org.apache.solr.cloud;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@ -85,6 +86,7 @@ public class OverseerAutoReplicaFailoverThread implements Runnable, Closeable {
private volatile boolean isClosed;
private ZkStateReader zkStateReader;
private final Cache<String,Long> baseUrlForBadNodes;
private Set<String> liveNodes = Collections.EMPTY_SET;
private final int workLoopDelay;
private final int waitAfterExpiration;
@ -151,11 +153,13 @@ public class OverseerAutoReplicaFailoverThread implements Runnable, Closeable {
return;
}
if (clusterState != null) {
if (lastClusterStateVersion == clusterState.getZkClusterStateVersion() && baseUrlForBadNodes.size() == 0) {
if (lastClusterStateVersion == clusterState.getZkClusterStateVersion() && baseUrlForBadNodes.size() == 0 &&
liveNodes.equals(clusterState.getLiveNodes())) {
// nothing has changed, no work to do
return;
}
liveNodes = clusterState.getLiveNodes();
lastClusterStateVersion = clusterState.getZkClusterStateVersion();
Set<String> collections = clusterState.getCollections();
for (final String collection : collections) {