Class SavepointUtils


  • public class SavepointUtils
    extends java.lang.Object
    Savepoint utilities.
    • Constructor Summary

      Constructors 
      Constructor Description
      SavepointUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String createSavepointError​(org.apache.flink.kubernetes.operator.api.status.SavepointInfo savepointInfo, java.lang.Long triggerNonce)  
      static SavepointStatus getLastSavepointStatus​(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,​?> resource)  
      static org.apache.flink.core.execution.SavepointFormatType getSavepointFormatType​(org.apache.flink.configuration.Configuration configuration)  
      static boolean gracePeriodEnded​(org.apache.flink.configuration.Configuration conf, org.apache.flink.kubernetes.operator.api.status.SavepointInfo savepointInfo)  
      static void resetTriggerIfJobNotRunning​(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,​?> resource, EventRecorder eventRecorder)  
      static boolean savepointInProgress​(org.apache.flink.kubernetes.operator.api.status.JobStatus jobStatus)  
      protected static java.util.Optional<org.apache.flink.kubernetes.operator.api.status.SavepointTriggerType> shouldTriggerSavepoint​(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,​?> resource, org.apache.flink.configuration.Configuration conf)
      Checks whether savepoint should be triggered based on the current status and spec and if yes, returns the correct SavepointTriggerType.
      static boolean triggerSavepointIfNeeded​(FlinkService flinkService, org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,​?> resource, org.apache.flink.configuration.Configuration conf)
      Triggers any pending manual or periodic savepoints and updates the status accordingly.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SavepointUtils

        public SavepointUtils()
    • Method Detail

      • savepointInProgress

        public static boolean savepointInProgress​(org.apache.flink.kubernetes.operator.api.status.JobStatus jobStatus)
      • getLastSavepointStatus

        public static SavepointStatus getLastSavepointStatus​(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,​?> resource)
      • triggerSavepointIfNeeded

        public static boolean triggerSavepointIfNeeded​(FlinkService flinkService,
                                                       org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,​?> resource,
                                                       org.apache.flink.configuration.Configuration conf)
                                                throws java.lang.Exception
        Triggers any pending manual or periodic savepoints and updates the status accordingly.
        Parameters:
        flinkService - FlinkService used to trigger savepoints
        resource - Resource that should be savepointed
        conf - Observe config of the resource
        Returns:
        True if a savepoint was triggered
        Throws:
        java.lang.Exception - Error during savepoint triggering.
      • shouldTriggerSavepoint

        @VisibleForTesting
        protected static java.util.Optional<org.apache.flink.kubernetes.operator.api.status.SavepointTriggerType> shouldTriggerSavepoint​(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,​?> resource,
                                                                                                                                         org.apache.flink.configuration.Configuration conf)
        Checks whether savepoint should be triggered based on the current status and spec and if yes, returns the correct SavepointTriggerType.

        This logic is responsible for both manual and periodic savepoint triggering.

        Parameters:
        resource - Resource to be savepointed
        conf - Observe configuration of the resource
        Returns:
        Optional @SavepointTriggerType
      • gracePeriodEnded

        public static boolean gracePeriodEnded​(org.apache.flink.configuration.Configuration conf,
                                               org.apache.flink.kubernetes.operator.api.status.SavepointInfo savepointInfo)
      • resetTriggerIfJobNotRunning

        public static void resetTriggerIfJobNotRunning​(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,​?> resource,
                                                       EventRecorder eventRecorder)
      • createSavepointError

        public static java.lang.String createSavepointError​(org.apache.flink.kubernetes.operator.api.status.SavepointInfo savepointInfo,
                                                            java.lang.Long triggerNonce)
      • getSavepointFormatType

        public static org.apache.flink.core.execution.SavepointFormatType getSavepointFormatType​(org.apache.flink.configuration.Configuration configuration)