Fix race in testSendSnapshotSendsOps (#59831)

There is a race between increase and get the global checkpoint in the 
test as indexTranslogOperations can be executed concurrently.

Closes #59492
This commit is contained in:
Nhat Nguyen 2020-07-20 08:35:08 -04:00
parent cc6edc39a1
commit 0031dea9cc
1 changed files with 3 additions and 1 deletions

View File

@ -245,7 +245,9 @@ public class RecoverySourceHandlerTests extends ESTestCase {
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());
}
};