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 2020/10/20 10:37:19 UTC

[GitHub] [flink] pnowojski commented on a change in pull request #13667: [FLINK-19679] Deduplicate code between CheckpointBarrierUnaligner and CheckpointBarrierAligner

pnowojski commented on a change in pull request #13667:
URL: https://github.com/apache/flink/pull/13667#discussion_r508393114



##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierBehaviourController.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.streaming.runtime.io;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.runtime.checkpoint.CheckpointException;
+import org.apache.flink.runtime.checkpoint.channel.InputChannelInfo;
+import org.apache.flink.runtime.io.network.api.CheckpointBarrier;
+
+import java.io.IOException;
+
+/**
+ * Controls when the checkpoint should be actually triggered.
+ */
+@Internal
+public interface CheckpointBarrierBehaviourController {
+
+	void barrierReceived(InputChannelInfo channelInfo, CheckpointBarrier barrier);
+
+	/**
+	 * @return {@code true} if checkpoint should be triggered.
+	 */
+	boolean firstBarrierReceived(InputChannelInfo channelInfo, CheckpointBarrier barrier) throws IOException;

Review comment:
       - For passive timeouting aligned checkpoints I'm planning to at least return `boolean` from `barrierReceived()` or `barrierAnnouncementReceived()`
   - For active timeouting there will be some even more elaborate/complicated/non trivial triggering mechanism on some timeout. I'm not entirely sure how this would be implemented (but this might not make it to 1.12, so we could put this aside for the time being).
   - I wanted to have the control mechanism when to trigger checkpoint encapsulated in the `SingleCheckpointBarrierHandler` and not hard coded inside the `CheckpointBarrierHandler`. Having an enum, would move this logic actually to the `CheckpointBarrierHandler`, which would have hard coded `if-ologic` code what to do where, instead of encapsulating it inside the controller.
   - I'm not sure how error prone this is. Please take a look how trivial are those classes. Controllers are trivial. Contract for triggering the checkpoints between them is also trivial - `return true`. (for active timeout this might be replaced by some other callback)




----------------------------------------------------------------
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:
users@infra.apache.org