danny0405 commented on code in PR #8163:
URL: https://github.com/apache/hudi/pull/8163#discussion_r1141737924
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/client/transaction/TestBucketIndexConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -111,6 +112,33 @@ public void
testConcurrentWritesWithInterleavingSuccessfulCommit() throws Except
}
}
+ @Test
+ public void testConcurrentWritesWithDifferentPartition() throws Exception {
+ createCommit(HoodieActiveTimeline.createNewInstantTime());
+ HoodieActiveTimeline timeline = metaClient.getActiveTimeline();
+ // consider commits before this are all successful
+ Option<HoodieInstant> lastSuccessfulInstant =
timeline.getCommitsTimeline().filterCompletedInstants().lastInstant();
+ // writer 1 starts
+ String currentWriterInstant = HoodieActiveTimeline.createNewInstantTime();
+ createInflightCommit(currentWriterInstant,
HoodieTestDataGenerator.DEFAULT_SECOND_PARTITION_PATH);
+ // writer 2 starts and finishes
+ String newInstantTime = HoodieActiveTimeline.createNewInstantTime();
+ createCommit(newInstantTime);
+
+ Option<HoodieInstant> currentInstant = Option.of(new
HoodieInstant(State.INFLIGHT, HoodieTimeline.COMMIT_ACTION,
currentWriterInstant));
+ SimpleConcurrentFileWritesConflictResolutionStrategy strategy = new
BucketIndexConcurrentFileWritesConflictResolutionStrategy();
+ HoodieCommitMetadata currentMetadata =
createCommitMetadata(currentWriterInstant,
HoodieTestDataGenerator.DEFAULT_SECOND_PARTITION_PATH);
+ timeline = timeline.reload();
+ List<HoodieInstant> candidateInstants =
strategy.getCandidateInstants(timeline, currentInstant.get(),
lastSuccessfulInstant).collect(
+ Collectors.toList());
+
+ // writer 1 conflicts with writer 2
+ Assertions.assertEquals(1, candidateInstants.size());
Review Comment:
> writer 1 conflicts with writer 2
I guess you meant not to conflict?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]