Skip to content

Commit d46d931

Browse files
authored
Fix testSeqNoCollision (#52588)
Adjusts the assertion as we trim translog more eagerly since #52556. Relates #52556 Closes #52148
1 parent f05b831 commit d46d931

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

server/src/test/java/org/elasticsearch/index/replication/IndexLevelReplicationTests.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,6 @@ public void testRequestFailureReplication() throws Exception {
536536
}
537537
}
538538

539-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/52148")
540539
public void testSeqNoCollision() throws Exception {
541540
try (ReplicationGroup shards = createGroup(2)) {
542541
shards.startAll();
@@ -567,19 +566,15 @@ public void testSeqNoCollision() throws Exception {
567566
}
568567
logger.info("--> Promote replica1 as the primary");
569568
shards.promoteReplicaToPrimary(replica1).get(); // wait until resync completed.
570-
// We roll a new translog generation and trim operations that are above the global checkpoint during primary-replica resync.
571-
// If the `initOperations` is empty, then the stale operation on the replica2 will be discarded as it is the only operation
572-
// in a translog file. Otherwise, the stale op will be retained along with initOperations but will be skipped in snapshot.
573-
int staleOps = initOperations.isEmpty() ? 0 : 1;
574569
shards.index(new IndexRequest(index.getName()).id("d2").source("{}", XContentType.JSON));
575570
final Translog.Operation op2;
576571
try (Translog.Snapshot snapshot = getTranslog(replica2).newSnapshot()) {
577-
assertThat(snapshot.totalOperations(), equalTo(initDocs + 1 + staleOps));
572+
assertThat(snapshot.totalOperations(), equalTo(1));
578573
op2 = snapshot.next();
579574
assertThat(op2.seqNo(), equalTo(op1.seqNo()));
580575
assertThat(op2.primaryTerm(), greaterThan(op1.primaryTerm()));
581-
assertThat("Remaining of snapshot should contain init operations", snapshot, containsOperationsInAnyOrder(initOperations));
582-
assertThat(snapshot.skippedOperations(), equalTo(staleOps));
576+
assertNull(snapshot.next());
577+
assertThat(snapshot.skippedOperations(), equalTo(0));
583578
}
584579

585580
// Make sure that peer-recovery transfers all but non-overridden operations.

0 commit comments

Comments
 (0)