danny0405 commented on code in PR #11151: URL: https://github.com/apache/hudi/pull/11151#discussion_r1590543447
########## hudi-client/hudi-client-common/src/test/java/org/apache/hudi/client/transaction/TestSimpleConcurrentFileWritesConflictResolutionStrategy.java: ########## @@ -193,6 +198,38 @@ public void testConcurrentWritesWithInterleavingScheduledCompaction() throws Exc } } + @Test + public void testConcurrentWritesWithInterleavingInflightCompaction() throws Exception { + createCommit(metaClient.createNewInstantTime(), metaClient); + HoodieActiveTimeline timeline = metaClient.getActiveTimeline(); + // consider commits before this are all successful + Option<HoodieInstant> lastSuccessfulInstant = timeline.getCommitsTimeline().filterCompletedInstants().lastInstant(); + // writer 1 starts + String currentWriterInstant = metaClient.createNewInstantTime(); + createInflightCommit(currentWriterInstant, metaClient); + // compaction 1 gets scheduled and becomes inflight + String newInstantTime = metaClient.createNewInstantTime(); + createPendingCompaction(newInstantTime, metaClient); + + Option<HoodieInstant> currentInstant = Option.of(new HoodieInstant(State.INFLIGHT, HoodieTimeline.DELTA_COMMIT_ACTION, currentWriterInstant)); + SimpleConcurrentFileWritesConflictResolutionStrategy strategy = new SimpleConcurrentFileWritesConflictResolutionStrategy(); + HoodieCommitMetadata currentMetadata = createCommitMetadata(currentWriterInstant); + metaClient.reloadActiveTimeline(); + List<HoodieInstant> candidateInstants = strategy.getCandidateInstants(metaClient, currentInstant.get(), lastSuccessfulInstant).collect( + Collectors.toList()); + // writer 1 conflicts with compaction 1 + Assertions.assertTrue(candidateInstants.size() == 1); Review Comment: Using `assertEquals` should be better. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org