Skip to content

Commit f4a4e41

Browse files
authored
Fix assertion in sync flush simulation (elastic#51831)
We perform a non-force flush in this test. It can be a noop on replicas if indexing are processed out of order. We should assert the IndexWriter instead of the translog before simulating a sync flush. Closes elastic#51750
1 parent 7e85fc4 commit f4a4e41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/test/java/org/elasticsearch/gateway/ReplicaShardAllocatorSyncIdIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected void commitIndexWriter(IndexWriter writer, Translog translog) throws I
8888
void syncFlush(String syncId) throws IOException {
8989
assertNotNull(indexWriter);
9090
try (ReleasableLock ignored = writeLock.acquire()) {
91-
assertThat(getTranslogStats().getUncommittedOperations(), equalTo(0));
91+
assertFalse(indexWriter.hasUncommittedChanges());
9292
Map<String, String> userData = new HashMap<>(getLastCommittedSegmentInfos().userData);
9393
userData.put(Engine.SYNC_COMMIT_ID, syncId);
9494
indexWriter.setLiveCommitData(userData.entrySet());

0 commit comments

Comments
 (0)