Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Segment Replication] Fix Flaky test SegmentReplicationRelocationIT.testPrimaryRelocation #10701

Merged
merged 9 commits into from
Oct 20, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,17 @@ public synchronized void sendFiles(GetSegmentFilesRequest request, ActionListene
);
};
cancellableThreads.checkForCancel();
final IndexShardRoutingTable routingTable = shard.getReplicationGroup().getRoutingTable();
ShardRouting targetShardRouting = routingTable.getByAllocationId(request.getTargetAllocationId());
if (targetShardRouting == null) {
logger.debug("delaying replication of {} as it is not listed as assigned to target node {}", shard.shardId(), targetNode);
throw new DelayRecoveryException("source node does not have the shard listed in its state as allocated on the node");
if (shard.isPrimaryMode()) {
Rishikesh1159 marked this conversation as resolved.
Show resolved Hide resolved
final IndexShardRoutingTable routingTable = shard.getReplicationGroup().getRoutingTable();
ShardRouting targetShardRouting = routingTable.getByAllocationId(request.getTargetAllocationId());
if (targetShardRouting == null) {
logger.debug(
"delaying replication of {} as it is not listed as assigned to target node {}",
shard.shardId(),
targetNode
);
throw new DelayRecoveryException("source node does not have the shard listed in its state as allocated on the node");
}
}

final StepListener<Void> sendFileStep = new StepListener<>();
Expand Down