Fix replication operation transient retry test (#58205)

After the work to retry transient replication failures, the local and
global checkpoint test metadata can be incremented on a different thread
than the test thread. This appears to introduce an extremely rare
scenario where this data is not visible for later test assertions. This
commit fixes the issue by using synchronized maps.
This commit is contained in:
Tim Brooks 2020-06-17 08:01:35 -06:00
parent 74c9402912
commit b6e6a8c090
No known key found for this signature in database
GPG Key ID: C2AA3BB91A889E77
1 changed files with 2 additions and 2 deletions

View File

@ -561,8 +561,8 @@ public class ReplicationOperationTests extends ESTestCase {
final long maxSeqNoOfUpdatesOrDeletes;
final Supplier<ReplicationGroup> replicationGroupSupplier;
final PendingReplicationActions pendingReplicationActions;
final Map<String, Long> knownLocalCheckpoints = new HashMap<>();
final Map<String, Long> knownGlobalCheckpoints = new HashMap<>();
final Map<String, Long> knownLocalCheckpoints = Collections.synchronizedMap(new HashMap<>());
final Map<String, Long> knownGlobalCheckpoints = Collections.synchronizedMap(new HashMap<>());
TestPrimary(ShardRouting routing, Supplier<ReplicationGroup> replicationGroupSupplier, ThreadPool threadPool) {
this.routing = routing;