SOLR-6847: LeaderInitiatedRecoveryThread compares wrong replica's state with lirState

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1653879 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2015-01-22 14:36:08 +00:00
parent ec01b5aeb5
commit bea1e9c608
2 changed files with 22 additions and 14 deletions

View File

@ -527,6 +527,9 @@ Bug Fixes
* SOLR-6640: Close searchers before rollback and recovery to avoid index corruption.
(Robert Muir, Varun Thacker, shalin)
* SOLR-6847: LeaderInitiatedRecoveryThread compares wrong replica's state with lirState.
(shalin)
Optimizations
----------------------

View File

@ -193,7 +193,7 @@ public class LeaderInitiatedRecoveryThread extends Thread {
// additional safeguard against the replica trying to be in the active state
// before acknowledging the leader initiated recovery command
if (continueTrying && collection != null && shardId != null) {
if (collection != null && shardId != null) {
try {
// call out to ZooKeeper to get the leader-initiated recovery state
String lirState =
@ -218,7 +218,9 @@ public class LeaderInitiatedRecoveryThread extends Thread {
List<ZkCoreNodeProps> replicaProps =
zkStateReader.getReplicaProps(collection, shardId, leaderCoreNodeName);
if (replicaProps != null && replicaProps.size() > 0) {
String replicaState = replicaProps.get(0).getState();
for (ZkCoreNodeProps prop : replicaProps) {
if (replicaCoreNodeName.equals(((Replica) prop.getNodeProps()).getName())) {
String replicaState = prop.getState();
if (ZkStateReader.ACTIVE.equals(replicaState)) {
// replica published its state as "active",
// which is bad if lirState is still "down"
@ -231,6 +233,9 @@ public class LeaderInitiatedRecoveryThread extends Thread {
shardId, replicaUrl, nodeProps, true); // force republish state to "down"
}
}
break;
}
}
}
}
} catch (Exception ignoreMe) {