Only fail the relocation target when a replication request on it fails
This commit addresses an issue when handling a failed replication request against a relocating target shard. Namely, if a replication request fails against the target of a relocation we currently fail both the source and the target. This leads to an unnecessary recovery. Instead, only the target of the relocation should be failed.
This commit is contained in:
parent
cd56366378
commit
75106daf9c
|
@ -844,11 +844,11 @@ public abstract class TransportReplicationAction<Request extends ReplicationRequ
|
|||
// we never execute replication operation locally as primary operation has already completed locally
|
||||
// hence, we ignore any local shard for replication
|
||||
if (nodes.localNodeId().equals(shard.currentNodeId()) == false) {
|
||||
performOnReplica(shard, shard.currentNodeId());
|
||||
performOnReplica(shard);
|
||||
}
|
||||
// send operation to relocating shard
|
||||
if (shard.relocating()) {
|
||||
performOnReplica(shard, shard.relocatingNodeId());
|
||||
performOnReplica(shard.buildTargetRelocatingShard());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -856,9 +856,10 @@ public abstract class TransportReplicationAction<Request extends ReplicationRequ
|
|||
/**
|
||||
* send replica operation to target node
|
||||
*/
|
||||
void performOnReplica(final ShardRouting shard, final String nodeId) {
|
||||
void performOnReplica(final ShardRouting shard) {
|
||||
// if we don't have that node, it means that it might have failed and will be created again, in
|
||||
// this case, we don't have to do the operation, and just let it failover
|
||||
String nodeId = shard.currentNodeId();
|
||||
if (!nodes.nodeExists(nodeId)) {
|
||||
logger.trace("failed to send action [{}] on replica [{}] for request [{}] due to unknown node [{}]", transportReplicaAction, shard.shardId(), replicaRequest, nodeId);
|
||||
onReplicaFailure(nodeId, null);
|
||||
|
|
|
@ -418,7 +418,6 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/15790")
|
||||
public void testReplication() throws ExecutionException, InterruptedException {
|
||||
final String index = "test";
|
||||
final ShardId shardId = new ShardId(index, 0);
|
||||
|
@ -442,7 +441,6 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|||
runReplicateTest(shardRoutingTable, assignedReplicas, totalShards);
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/15790")
|
||||
public void testReplicationWithShadowIndex() throws ExecutionException, InterruptedException {
|
||||
final String index = "test";
|
||||
final ShardId shardId = new ShardId(index, 0);
|
||||
|
|
Loading…
Reference in New Issue