Skip to content

Commit

Permalink
Add remote recovery to ShardFollowTaskReplicationTests (#39007)
Browse files Browse the repository at this point in the history
We simulate remote recovery in ShardFollowTaskReplicationTests 
by bootstrapping the follower with the safe commit of the leader.

Relates #35975
  • Loading branch information
dnhatn committed Feb 18, 2019
1 parent ee879c9 commit 62ed1aa
Show file tree
Hide file tree
Showing 2 changed files with 301 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,7 @@ public synchronized int startReplicas(int numOfReplicasToStart) throws IOExcepti
}

public void startPrimary() throws IOException {
final DiscoveryNode pNode = getDiscoveryNode(primary.routingEntry().currentNodeId());
primary.markAsRecovering("store", new RecoveryState(primary.routingEntry(), pNode, null));
primary.recoverFromStore();
recoverPrimary(primary);
HashSet<String> activeIds = new HashSet<>();
activeIds.addAll(activeIds());
activeIds.add(primary.routingEntry().allocationId().getId());
Expand Down Expand Up @@ -302,6 +300,11 @@ assert shardRoutings().stream()
updateAllocationIDsOnPrimary();
}

protected synchronized void recoverPrimary(IndexShard primary) {
final DiscoveryNode pNode = getDiscoveryNode(primary.routingEntry().currentNodeId());
primary.markAsRecovering("store", new RecoveryState(primary.routingEntry(), pNode, null));
primary.recoverFromStore();
}

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

0 comments on commit 62ed1aa

Please sign in to comment.