Class SnapshotUtils
- java.lang.Object
-
- org.apache.flink.kubernetes.operator.utils.SnapshotUtils
-
public class SnapshotUtils extends java.lang.Object
Savepoint utilities.
-
-
Constructor Summary
Constructors Constructor Description SnapshotUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
checkpointInProgress(JobStatus jobStatus)
static SnapshotStatus
getLastSnapshotStatus(AbstractFlinkResource<?,?> resource, SnapshotType snapshotType)
static boolean
gracePeriodEnded(java.time.Duration gracePeriod, SnapshotInfo snapshotInfo)
static boolean
isSnapshotTriggeringSupported(org.apache.flink.configuration.Configuration conf)
static void
resetSnapshotTriggers(AbstractFlinkResource<?,?> resource, EventRecorder eventRecorder, io.fabric8.kubernetes.client.KubernetesClient client)
static boolean
savepointInProgress(JobStatus jobStatus)
protected static java.util.Optional<SnapshotTriggerType>
shouldTriggerSnapshot(AbstractFlinkResource<?,?> resource, org.apache.flink.configuration.Configuration conf, SnapshotType snapshotType)
Checks whether a snapshot should be triggered based on the current status and spec, and if yes, returns the correctSnapshotTriggerType
.static boolean
triggerSnapshotIfNeeded(FlinkService flinkService, AbstractFlinkResource<?,?> resource, org.apache.flink.configuration.Configuration conf, SnapshotType snapshotType)
Triggers any pending manual or periodic snapshots and updates the status accordingly.
-
-
-
Method Detail
-
savepointInProgress
public static boolean savepointInProgress(JobStatus jobStatus)
-
checkpointInProgress
public static boolean checkpointInProgress(JobStatus jobStatus)
-
getLastSnapshotStatus
@VisibleForTesting public static SnapshotStatus getLastSnapshotStatus(AbstractFlinkResource<?,?> resource, SnapshotType snapshotType)
-
triggerSnapshotIfNeeded
public static boolean triggerSnapshotIfNeeded(FlinkService flinkService, AbstractFlinkResource<?,?> resource, org.apache.flink.configuration.Configuration conf, SnapshotType snapshotType) throws java.lang.Exception
Triggers any pending manual or periodic snapshots and updates the status accordingly.- Parameters:
flinkService
- TheFlinkService
used to trigger snapshots.resource
- The resource that should be snapshotted.conf
- The observe config of the resource.- Returns:
- True if a snapshot was triggered.
- Throws:
java.lang.Exception
- An error during snapshot triggering.
-
shouldTriggerSnapshot
@VisibleForTesting protected static java.util.Optional<SnapshotTriggerType> shouldTriggerSnapshot(AbstractFlinkResource<?,?> resource, org.apache.flink.configuration.Configuration conf, SnapshotType snapshotType)
Checks whether a snapshot should be triggered based on the current status and spec, and if yes, returns the correctSnapshotTriggerType
.This logic is responsible for both manual and periodic snapshots triggering.
- Parameters:
resource
- The resource to be snapshotted.conf
- The observe configuration of the resource.snapshotType
- The type of the snapshot.- Returns:
- An optional
SnapshotTriggerType
.
-
isSnapshotTriggeringSupported
public static boolean isSnapshotTriggeringSupported(org.apache.flink.configuration.Configuration conf)
-
gracePeriodEnded
public static boolean gracePeriodEnded(java.time.Duration gracePeriod, SnapshotInfo snapshotInfo)
-
resetSnapshotTriggers
public static void resetSnapshotTriggers(AbstractFlinkResource<?,?> resource, EventRecorder eventRecorder, io.fabric8.kubernetes.client.KubernetesClient client)
-
-