You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/07/20 08:53:35 UTC

[GitHub] [flink] beyond1920 commented on a diff in pull request #20299: [FLINK-28586] Enable speculative execution for new sources

beyond1920 commented on code in PR #20299:
URL: https://github.com/apache/flink/pull/20299#discussion_r925348071


##########
flink-runtime/src/main/java/org/apache/flink/runtime/source/coordinator/SourceCoordinatorContext.java:
##########
@@ -431,4 +489,125 @@ private <V> V callInCoordinatorThread(Callable<V> callable, String errorMessage)
             throw new FlinkRuntimeException(errorMessage, t);
         }
     }
+
+    private void assignSplitsToAttempts(SplitsAssignment<SplitT> assignment) {
+        assignment.assignment().forEach((index, splits) -> assignSplitsToAttempts(index, splits));
+    }
+
+    private void assignSplitsToAttempts(int subtaskIndex, List<SplitT> splits) {
+        getRegisteredAttempts(subtaskIndex)
+                .forEach(attempt -> assignSplitsToAttempt(subtaskIndex, attempt, splits));
+    }
+
+    private void assignSplitsToAttempt(int subtaskIndex, int attemptNumber, List<SplitT> splits) {
+        checkAttemptReaderReady(subtaskIndex, attemptNumber);
+
+        final AddSplitEvent<SplitT> addSplitEvent;
+        try {
+            addSplitEvent = new AddSplitEvent<>(splits, splitSerializer);

Review Comment:
   It's better not send this message if splits is empty or null.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org