sunhaibotb commented on a change in pull request #8811: [FLINK-12777][network] 
Support CheckpointBarrierHandler in StreamTwoInputSelectableProcessor
URL: https://github.com/apache/flink/pull/8811#discussion_r297558707
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierTracker.java
 ##########
 @@ -275,28 +211,34 @@ else if (checkpointId > latestPendingCheckpointID) {
                } else {
                        // trailing cancellation barrier which was already 
cancelled
                }
+               return false;
        }
 
-       private void notifyCheckpoint(long checkpointId, long timestamp, 
CheckpointOptions checkpointOptions) throws Exception {
-               if (toNotifyOnCheckpoint != null) {
-                       CheckpointMetaData checkpointMetaData = new 
CheckpointMetaData(checkpointId, timestamp);
-                       CheckpointMetrics checkpointMetrics = new 
CheckpointMetrics()
-                               .setBytesBufferedInAlignment(0L)
-                               .setAlignmentDurationNanos(0L);
-
-                       
toNotifyOnCheckpoint.triggerCheckpointOnBarrier(checkpointMetaData, 
checkpointOptions, checkpointMetrics);
+       @Override
+       public boolean processEndOfPartition() throws Exception {
+               while (!pendingCheckpoints.isEmpty()) {
+                       CheckpointBarrierCount barrierCount = 
pendingCheckpoints.removeFirst();
+                       if (barrierCount.markAborted()) {
+                               notifyAbort(barrierCount.checkpointId(),
+                                       new 
CheckpointException(CheckpointFailureReason.CHECKPOINT_DECLINED_INPUT_END_OF_STREAM));
+                       }
                }
+               return false;
        }
 
-       private void notifyAbort(long checkpointId) throws Exception {
-               if (toNotifyOnCheckpoint != null) {
-                       toNotifyOnCheckpoint.abortCheckpointOnBarrier(
-                               checkpointId,
-                               new 
CheckpointException(CheckpointFailureReason.CHECKPOINT_DECLINED_ON_CANCELLATION_BARRIER));
-               }
+       public long getLatestCheckpointId() {
+               long latestCheckpointId = pendingCheckpoints.isEmpty() ? -1 : 
pendingCheckpoints.peekLast().checkpointId();
 
 Review comment:
   It can return results directly without requiring the local variable.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to