From 58ab9437ee526bc6f473e5b0ccc7065a2b8222ae Mon Sep 17 00:00:00 2001 From: ohad Date: Tue, 5 May 2026 16:41:32 -0400 Subject: [PATCH] Don't merge before all threads are done --- .../directory/PendingWriteQueueIntegrationTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fdb-record-layer-lucene/src/test/java/com/apple/foundationdb/record/lucene/directory/PendingWriteQueueIntegrationTest.java b/fdb-record-layer-lucene/src/test/java/com/apple/foundationdb/record/lucene/directory/PendingWriteQueueIntegrationTest.java index ed484b74c1..4a0cd52dd1 100644 --- a/fdb-record-layer-lucene/src/test/java/com/apple/foundationdb/record/lucene/directory/PendingWriteQueueIntegrationTest.java +++ b/fdb-record-layer-lucene/src/test/java/com/apple/foundationdb/record/lucene/directory/PendingWriteQueueIntegrationTest.java @@ -816,11 +816,14 @@ void testConcurrentMixedOperations(boolean withMerge) { snooze(10); // increase the chances of concurrency commit(context); } - if (threadId == 2 && withMerge) { - mergeIndexNow(schemaSetup, index); - } }); + // Merge the index outside the loop, as the merge will clear the pending writes flag and may cause conflicts + // on the index + if (withMerge) { + mergeIndexNow(schemaSetup, index); + } + // Verify operation counts assertEquals(10, insertCount.get()); // 5 threads * 2 inserts assertEquals(5, updateCount.get()); // 5 threads * 1 update (DELETE+INSERT in queue)