liming30 commented on code in PR #529:
URL: https://github.com/apache/flink-table-store/pull/529#discussion_r1106608305
##########
flink-table-store-connector/src/test/java/org/apache/flink/table/store/connector/source/ContinuousFileSplitEnumeratorTest.java:
##########
@@ -105,6 +105,57 @@ public void testSplitAllocationIsOrdered() throws
Exception {
}
}
+ @Test
+ public void testSplitAllocationIsFair() throws Exception {
+ final TestingSplitEnumeratorContext<FileStoreSourceSplit> context =
+ new TestingSplitEnumeratorContext<>(1);
+ context.registerReader(0, "test-host");
+
+ List<FileStoreSourceSplit> initialSplits = new ArrayList<>();
+ for (int i = 1; i <= 2; i++) {
+ initialSplits.add(createSnapshotSplit(i, 0,
Collections.emptyList()));
+ initialSplits.add(createSnapshotSplit(i, 1,
Collections.emptyList()));
+ }
+
+ List<FileStoreSourceSplit> expectedSplits = new
ArrayList<>(initialSplits);
+
+ final ContinuousFileSplitEnumerator enumerator =
+ new Builder()
+ .setSplitEnumeratorContext(context)
+ .setInitialSplits(initialSplits)
+ .setDiscoveryInterval(3)
+ .build();
+
+ // each time a split is allocated from bucket-0 and bucket-1
+ enumerator.handleSplitRequest(0, "test-host");
+ Map<Integer, SplitAssignmentState<FileStoreSourceSplit>> assignments =
+ context.getSplitAssignments();
+ // Only subtask-0 is allocated.
+ Assertions.assertThat(assignments.size()).isEqualTo(1);
Review Comment:
Thanks for your suggestion, I have rewritten all `assertions` related code
in this class.
--
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]