pnowojski commented on a change in pull request #13741:
URL: https://github.com/apache/flink/pull/13741#discussion_r512233153
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointOptions.java
##########
@@ -47,29 +50,56 @@
private final boolean isUnalignedCheckpoint;
+ private final long alignmentTimeout;
+
+ public static CheckpointOptions create(
+ CheckpointType checkpointType,
+ CheckpointStorageLocationReference locationReference,
+ boolean isExactlyOnceMode,
+ boolean unalignedCheckpointsEnabled,
+ long alignmentTimeout) {
+ boolean canBeUnaligned = checkpointType ==
CheckpointType.CHECKPOINT && unalignedCheckpointsEnabled;
+ return new CheckpointOptions(
+ checkpointType,
+ locationReference,
+ isExactlyOnceMode,
+ canBeUnaligned && alignmentTimeout == 0,
+ canBeUnaligned ? alignmentTimeout :
NO_ALIGNMENT_TIME_OUT);
+ }
+
@VisibleForTesting
public CheckpointOptions(
CheckpointType checkpointType,
CheckpointStorageLocationReference targetLocation) {
- this(checkpointType, targetLocation, true, false);
+ this(checkpointType, targetLocation, true, false,
NO_ALIGNMENT_TIME_OUT);
}
public CheckpointOptions(
CheckpointType checkpointType,
CheckpointStorageLocationReference targetLocation,
boolean isExactlyOnceMode,
- boolean isUnalignedCheckpoint) {
+ boolean isUnalignedCheckpoint,
+ long alignmentTimeout) {
this.checkpointType = checkNotNull(checkpointType);
this.targetLocation = checkNotNull(targetLocation);
this.isExactlyOnceMode = isExactlyOnceMode;
this.isUnalignedCheckpoint = isUnalignedCheckpoint;
+ this.alignmentTimeout = alignmentTimeout;
}
public boolean needsAlignment() {
return isExactlyOnceMode() &&
(getCheckpointType().isSavepoint() || !isUnalignedCheckpoint());
}
+ public long getAlignmentTimeout() {
+ return alignmentTimeout;
+ }
+
+ public boolean isTimeoutable() {
+ return alignmentTimeout > 0 && alignmentTimeout !=
NO_ALIGNMENT_TIME_OUT;
Review comment:
Initially I had this, but `Long.MAX_VALUE` works better with
`getAlignmentTimeout()`, as `Long.MAX_VALUE` is for all of the practical
purposes `NO_ALIGNMENT_TIME_OUT` :)
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/CheckpointBarrierAnnouncement.java
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.runtime.io.network.api;
+
+import org.apache.flink.core.memory.DataInputView;
+import org.apache.flink.core.memory.DataOutputView;
+import org.apache.flink.runtime.event.RuntimeEvent;
+
+import java.io.IOException;
+import java.util.Objects;
+
+/**
+ * {@link CheckpointBarrierAnnouncement} is announcing presence or receiving
of a {@link CheckpointBarrier}.
+ * That {@link #announcedBarrier} is identified by it's sequence number.
+ */
+public class CheckpointBarrierAnnouncement extends RuntimeEvent {
Review comment:
At the same time, I'm not sure if we will ever need announcement of
other events and it would either:
- require `checkState` very early on, and still complicate the code a little
bit
- add `checkState` later and complicate the code even more
----------------------------------------------------------------
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]