mxm commented on code in PR #724:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/724#discussion_r1418806188


##########
docs/content/docs/custom-resource/job-management.md:
##########
@@ -288,12 +288,33 @@ Rollback is currently only supported for 
`FlinkDeployments`.
 
 ## Manual Recovery
 
-There are cases when manual intervention is required from the user to recover 
a Flink application deployment.
+There are cases when manual intervention is required from the user to recover 
a Flink application deployment or to restore to a user specified state.
 
 In most of these situations the main reason for this is that the deployment 
got into a state where the operator cannot determine the health of the 
application or the latest checkpoint information to be used for recovery.
 While these cases are not common, we need to be prepared to handle them.
 
-Fortunately almost any issue can be recovered by the user manually by using 
the following steps:
+Users have two options to restore a job from a target savepoint / checkpoint
+
+### Redeploy using the savepointRedeployNonce
+
+It is possible to redeploy a `FlinkDeployment` or `FlinkSessionJob` resource 
from a target savepoint by using the combination of `savepointRedeployNonce` 
and `initialSavepointPath` in the job spec:
+
+```yaml
+ job:
+   initialSavepointPath: file://redeploy-target-savepoint
+   savepointRedeployNonce: null -> 1

Review Comment:
   I think this is irritating. How about adding a comment? 
   ```suggestion
      # If not set previously, set to 1, otherwise increment, e.g. 2
      savepointRedeployNonce: 1
   ```



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/AbstractJobReconciler.java:
##########
@@ -306,6 +319,40 @@ protected void resubmitJob(FlinkResourceContext<CR> ctx, 
boolean requireHaMetada
         restoreJob(ctx, specToRecover, ctx.getObserveConfig(), 
requireHaMetadata);
     }
 
+    private void redeployWithSavepoint(
+            FlinkResourceContext<CR> ctx,
+            Configuration deployConfig,
+            CR resource,
+            STATUS status,
+            SPEC currentDeploySpec,
+            JobState desiredJobState)
+            throws Exception {
+        LOG.info("Redeploying from savepoint");
+        cancelJob(ctx, UpgradeMode.STATELESS);

Review Comment:
   So we ignore the upgrade policy here and discard the state? What if the new 
savepoint path is corrupted or doesn't exist?



##########
flink-kubernetes-operator-api/src/main/java/org/apache/flink/kubernetes/operator/api/diff/DiffType.java:
##########
@@ -28,7 +28,9 @@ public enum DiffType {
     /** Scalable spec change. */
     SCALE,
     /** Upgradable spec change. */
-    UPGRADE;
+    UPGRADE,
+    /** Full redeploy from new state. */
+    SAVEPOINT_REDEPLOY;

Review Comment:
   Why do we need a new state? Isn't that also an `UPGRADE`? I suppose we could 
also special case inside the upgrade path when the nonce has been set. We also 
use `UPGRADE` for normal restarts.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to