Skip to content

Commit

Permalink
Fix replication operation transient retry test (#58205)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Tim-Brooks committed Jul 16, 2020
1 parent 6f227be commit 1f283c7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ static class TestPrimary implements ReplicationOperation.Primary<Request, Reques
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;
Expand Down

0 comments on commit 1f283c7

Please sign in to comment.