From 01699655b2b51ae48e35d29aa96dd812d3303535 Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Sat, 2 Feb 2019 09:19:32 -0500 Subject: [PATCH] FIx testReplicaIgnoresOlderRetentionLeasesVersion (#38246) If the innerLength is 0, the version won't be increased; then there will be two RetentionLeases with the same term and version, but their leases are different. Relates #37951 Closes #38245 --- .../index/seqno/ReplicationTrackerRetentionLeaseTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/test/java/org/elasticsearch/index/seqno/ReplicationTrackerRetentionLeaseTests.java b/server/src/test/java/org/elasticsearch/index/seqno/ReplicationTrackerRetentionLeaseTests.java index 4a86d0fdcf754..5fa2df93db334 100644 --- a/server/src/test/java/org/elasticsearch/index/seqno/ReplicationTrackerRetentionLeaseTests.java +++ b/server/src/test/java/org/elasticsearch/index/seqno/ReplicationTrackerRetentionLeaseTests.java @@ -339,8 +339,8 @@ public void testReplicaIgnoresOlderRetentionLeasesVersion() { for (int j = 0; j < innerLength; j++) { leases.add( new RetentionLease(i + "-" + j, randomNonNegativeLong(), randomNonNegativeLong(), randomAlphaOfLength(8))); - version++; } + version++; if (rarely()) { primaryTerm++; }