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 2022/10/05 20:04:01 UTC

[GitHub] [flink-kubernetes-operator] morhidi commented on a diff in pull request #388: [FLINK-29413] Make it possible to associate triggered and completed savepoints

morhidi commented on code in PR #388:
URL: https://github.com/apache/flink-kubernetes-operator/pull/388#discussion_r985735711


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/crd/status/Savepoint.java:
##########
@@ -38,7 +36,42 @@ public class Savepoint {
     /** Savepoint trigger mechanism. */
     private SavepointTriggerType triggerType = SavepointTriggerType.UNKNOWN;
 
-    public static Savepoint of(String location, SavepointTriggerType type) {
-        return new Savepoint(System.currentTimeMillis(), location, type);
+    private SavepointFormatType formatType = SavepointFormatType.UNKNOWN;
+
+    /**
+     * Nonce value used when the savepoint was triggered manually {@link
+     * SavepointTriggerType#MANUAL}, defaults to 0.
+     */
+    private Long triggerNonce = 0L;
+
+    public Savepoint(
+            long timeStamp,
+            String location,
+            SavepointTriggerType triggerType,
+            SavepointFormatType formatType,
+            Long triggerNonce) {
+        this.timeStamp = timeStamp;
+        this.location = location;
+        this.triggerType = triggerType;
+        this.formatType = formatType;
+        setTriggerNonce(triggerNonce);
+    }
+
+    public static Savepoint of(String location, SavepointTriggerType triggerType) {
+        return new Savepoint(
+                System.currentTimeMillis(), location, triggerType, SavepointFormatType.UNKNOWN, 0L);
+    }
+
+    public static Savepoint of(
+            String location, SavepointTriggerType triggerType, SavepointFormatType formatType) {
+        return new Savepoint(System.currentTimeMillis(), location, triggerType, formatType, 0L);
+    }

Review Comment:
   I could've used nulls in the static helpers, but I added the null handling for a different purpose. Mainly to handle deserialization scenarios for older savepoints with no nonce. I guess it's using the default constructors + setters.



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/crd/status/Savepoint.java:
##########
@@ -38,7 +36,42 @@ public class Savepoint {
     /** Savepoint trigger mechanism. */
     private SavepointTriggerType triggerType = SavepointTriggerType.UNKNOWN;
 
-    public static Savepoint of(String location, SavepointTriggerType type) {
-        return new Savepoint(System.currentTimeMillis(), location, type);
+    private SavepointFormatType formatType = SavepointFormatType.UNKNOWN;
+
+    /**
+     * Nonce value used when the savepoint was triggered manually {@link
+     * SavepointTriggerType#MANUAL}, defaults to 0.
+     */
+    private Long triggerNonce = 0L;
+
+    public Savepoint(
+            long timeStamp,
+            String location,
+            SavepointTriggerType triggerType,
+            SavepointFormatType formatType,
+            Long triggerNonce) {
+        this.timeStamp = timeStamp;
+        this.location = location;
+        this.triggerType = triggerType;
+        this.formatType = formatType;
+        setTriggerNonce(triggerNonce);
+    }
+
+    public static Savepoint of(String location, SavepointTriggerType triggerType) {
+        return new Savepoint(
+                System.currentTimeMillis(), location, triggerType, SavepointFormatType.UNKNOWN, 0L);
+    }
+
+    public static Savepoint of(
+            String location, SavepointTriggerType triggerType, SavepointFormatType formatType) {
+        return new Savepoint(System.currentTimeMillis(), location, triggerType, formatType, 0L);
+    }

Review Comment:
   The static helpers where there for convenince.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org