@@ -67,12 +67,14 @@ public static void openCheckpoint(StreamExecutionEnvironment env, Properties pro
6767 }
6868
6969 //设置了时间间隔才表明开启了checkpoint
70- if (properties .getProperty (ConfigConstrant .FLINK_CHECKPOINT_INTERVAL_KEY ) == null ){
70+ if (properties .getProperty (ConfigConstrant .SQL_CHECKPOINT_INTERVAL_KEY ) == null && properties . getProperty ( ConfigConstrant . FLINK_CHECKPOINT_INTERVAL_KEY ) == null ){
7171 return ;
7272 }else {
73- Long interval = Long .valueOf (properties .getProperty (ConfigConstrant .FLINK_CHECKPOINT_INTERVAL_KEY ));
73+ Long sql_interval = Long .valueOf (properties .getProperty (ConfigConstrant .SQL_CHECKPOINT_INTERVAL_KEY ,"0" ));
74+ Long flink_interval = Long .valueOf (properties .getProperty (ConfigConstrant .FLINK_CHECKPOINT_INTERVAL_KEY , "0" ));
75+ long checkpointInterval = Math .max (sql_interval , flink_interval );
7476 //start checkpoint every ${interval}
75- env .enableCheckpointing (interval );
77+ env .enableCheckpointing (checkpointInterval );
7678 }
7779
7880 String checkMode = properties .getProperty (ConfigConstrant .FLINK_CHECKPOINT_MODE_KEY );
@@ -100,7 +102,14 @@ public static void openCheckpoint(StreamExecutionEnvironment env, Properties pro
100102 env .getCheckpointConfig ().setMaxConcurrentCheckpoints (maxConcurrCheckpoints );
101103 }
102104
103- String cleanupModeStr = properties .getProperty (ConfigConstrant .FLINK_CHECKPOINT_CLEANUPMODE_KEY );
105+ Boolean sqlCleanMode = MathUtil .getBoolean (properties .getProperty (ConfigConstrant .SQL_CHECKPOINT_CLEANUPMODE_KEY ), false );
106+ Boolean flinkCleanMode = MathUtil .getBoolean (properties .getProperty (ConfigConstrant .FLINK_CHECKPOINT_CLEANUPMODE_KEY ), false );
107+
108+ String cleanupModeStr = "false" ;
109+ if (sqlCleanMode || flinkCleanMode ){
110+ cleanupModeStr = "true" ;
111+ }
112+
104113 if ("true" .equalsIgnoreCase (cleanupModeStr )){
105114 env .getCheckpointConfig ().enableExternalizedCheckpoints (
106115 CheckpointConfig .ExternalizedCheckpointCleanup .DELETE_ON_CANCELLATION );
0 commit comments