Bubble up exception in follow task in ccr tests (#52085)

It's perfectly fine if a bulk request on the follower hits 
IndexShardClosedException in some CCR tests because we sometimes 
close some follower shards while the follow-task is replicating operations.
Instead of failing the test immediately, this commit bubbles up that
failure to the shard follow task.

Closes #52052
This commit is contained in:
Nhat Nguyen 2020-02-07 18:57:52 -05:00
parent 27265f032a
commit 864e9d875d
1 changed files with 5 additions and 1 deletions

View File

@ -126,6 +126,7 @@ public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTest
equalTo(leaderGroup.getPrimary().getLastKnownGlobalCheckpoint()));
followerGroup.assertAllEqual(indexedDocIds.size() - deleteDocIds.size());
});
assertNull(shardFollowTask.getStatus().getFatalException());
shardFollowTask.markAsCompleted();
assertConsistentHistoryBetweenLeaderAndFollower(leaderGroup, followerGroup, true);
}
@ -170,6 +171,7 @@ public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTest
assertThat(shardFollowTask.getFailure(), nullValue());
int expectedDoc = docCount;
assertBusy(() -> followerGroup.assertAllEqual(expectedDoc));
assertNull(shardFollowTask.getStatus().getFatalException());
shardFollowTask.markAsCompleted();
assertConsistentHistoryBetweenLeaderAndFollower(leaderGroup, followerGroup, hasPromotion == false);
}
@ -325,6 +327,7 @@ public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTest
equalTo(leadingPrimary.getLastKnownGlobalCheckpoint()));
assertConsistentHistoryBetweenLeaderAndFollower(leaderGroup, followerGroup, true);
});
assertNull(shardFollowTask.getStatus().getFatalException());
} finally {
shardFollowTask.markAsCompleted();
}
@ -398,6 +401,7 @@ public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTest
follower.recoverReplica(follower.addReplica());
}
assertBusy(() -> assertConsistentHistoryBetweenLeaderAndFollower(leader, follower, false));
assertNull(followTask.getStatus().getFatalException());
followTask.markAsCompleted();
}
}
@ -679,7 +683,7 @@ public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTest
request.getOperations(), request.getMaxSeqNoOfUpdatesOrDeletes(), primary, logger);
TransportWriteActionTestHelper.performPostWriteActions(primary, request, ccrResult.location, logger);
} catch (InterruptedException | ExecutionException | IOException e) {
throw new AssertionError(e);
throw new RuntimeException(e);
}
listener.onResponse(new PrimaryResult(ccrResult.replicaRequest(), ccrResult.finalResponseIfSuccessful));
}