Skip to content

Commit

Permalink
Fix race in testSendSnapshotSendsOps (#59831)
Browse files Browse the repository at this point in the history
There is a race between increase and get the global checkpoint in the 
test as indexTranslogOperations can be executed concurrently.

Closes #59492
  • Loading branch information
dnhatn committed Jul 23, 2020
1 parent 0e6ee7a commit 01bf097
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ public void testSendSnapshotSendsOps() throws IOException {
public void indexTranslogOperations(List<Translog.Operation> operations, int totalTranslogOps, long timestamp, long msu,
RetentionLeases retentionLeases, long mappingVersion, ActionListener<Long> listener) {
shippedOps.addAll(operations);
checkpointOnTarget.set(randomLongBetween(checkpointOnTarget.get(), Long.MAX_VALUE));
if (randomBoolean()) {
checkpointOnTarget.addAndGet(between(1, 20));
}
listener.onResponse(checkpointOnTarget.get());
}
};
Expand Down

0 comments on commit 01bf097

Please sign in to comment.