Skip to content

Commit 62ed1aa

Browse files
committed
Add remote recovery to ShardFollowTaskReplicationTests (#39007)
We simulate remote recovery in ShardFollowTaskReplicationTests by bootstrapping the follower with the safe commit of the leader. Relates #35975
1 parent ee879c9 commit 62ed1aa

File tree

2 files changed

+301
-221
lines changed

2 files changed

+301
-221
lines changed

test/framework/src/main/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,7 @@ public synchronized int startReplicas(int numOfReplicasToStart) throws IOExcepti
267267
}
268268

269269
public void startPrimary() throws IOException {
270-
final DiscoveryNode pNode = getDiscoveryNode(primary.routingEntry().currentNodeId());
271-
primary.markAsRecovering("store", new RecoveryState(primary.routingEntry(), pNode, null));
272-
primary.recoverFromStore();
270+
recoverPrimary(primary);
273271
HashSet<String> activeIds = new HashSet<>();
274272
activeIds.addAll(activeIds());
275273
activeIds.add(primary.routingEntry().allocationId().getId());
@@ -302,6 +300,11 @@ assert shardRoutings().stream()
302300
updateAllocationIDsOnPrimary();
303301
}
304302

303+
protected synchronized void recoverPrimary(IndexShard primary) {
304+
final DiscoveryNode pNode = getDiscoveryNode(primary.routingEntry().currentNodeId());
305+
primary.markAsRecovering("store", new RecoveryState(primary.routingEntry(), pNode, null));
306+
primary.recoverFromStore();
307+
}
305308

306309
public synchronized IndexShard addReplicaWithExistingPath(final ShardPath shardPath, final String nodeId) throws IOException {
307310
final ShardRouting shardRouting = TestShardRouting.newShardRouting(

0 commit comments

Comments
 (0)