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