Rion Williams
02/06/2024, 12:48 AMFlinkDeployment to handle suspending the previous job, taking a savepoint, and copying it over to the target savepoint directory for the new deployment (via the operator).
Using the upgradeMode: savepoint is the expectation that when the job runs that it use the savepoint in the savepoints directory? Or should I copy the savepoint to the checkpoints directory or another location to allow it to “automatically” pick up the savepoint? I’m trying to avoid a bunch of complicated post-rendering hooks to set things like the initialSavepointPath if possible. So I’m asking - is it possible to use the configured directories to restore a job from a savepoint (without explicitly setting the initialSavepointPath on the deployment?Taruj Goyal
02/06/2024, 1:19 AMRion Williams
02/06/2024, 1:21 AMupgrade mode: savepoint in this case.Taruj Goyal
02/06/2024, 1:23 AM<flink-job-alias>.flink.job.upgradeMode: savepoint
<flink-job-alias>.flink.job.initialSavepointPath: s3 directory to savepoint
2. Assuming that you restore your jobs and use s3 for the savepoints and checkpointing. Go to S3 and confirm that the bucket and the directory exists ahead of time.
aws s3 ls path_to_savepoint/savepoints/
aws s3api put-object --bucket savepoint_bucket --key ac-path_to_savepoint/savepoints/savepoint-restore-startpoint/
3. Ensure that the folder is created and then run the following script
#!/bin/bash
set -ex
JOB_NAME="flink-job-name"
NAMESPACE="namespace-of-cluster"
# Patch the existing Job to go to suspended mode to create savepoint
kubectl -n "$NAMESPACE" patch flinkdeployments "$JOB_NAME" --type=merge -p '{"spec": {"job": {"upgradeMode": "savepoint"}}}'
kubectl -n "$NAMESPACE" patch flinkdeployments "$JOB_NAME" --type=merge -p '{"spec": {"job": {"state": "suspended"}}}'
# Loop until the job is finished
while [ "$(kubectl get flinkdeployment "$JOB_NAME" -n "$NAMESPACE" -o jsonpath='{.status.jobStatus.state}')" != "FINISHED" ]; do
echo "Waiting for the job to finish..."
sleep 5
done
savepointPath=$(kubectl -n "$NAMESPACE" get flinkdeployments "$JOB_NAME" -o=jsonpath='{.status.jobStatus.savepointInfo.lastSavepoint.location}')
aws s3 sync $savepointPath ${savepointPath%/*}/savepoint-restore-startpoint
4. Delete the deployment for flink in the older environment and communicate ahead of time for the same to the team mates.Rion Williams
02/06/2024, 1:23 AMTaruj Goyal
02/06/2024, 1:23 AMTaruj Goyal
02/06/2024, 1:24 AMRion Williams
02/06/2024, 1:25 AMRion Williams
02/06/2024, 1:25 AMRion Williams
02/06/2024, 1:25 AMTaruj Goyal
02/06/2024, 1:26 AMRion Williams
02/06/2024, 1:32 AMRion Williams
02/06/2024, 1:34 AMRion Williams
02/06/2024, 1:35 AMRion Williams
02/06/2024, 1:42 AMGyula Fóra
02/06/2024, 5:45 AMGyula Fóra
02/06/2024, 5:46 AMPrithvi Dammalapati
02/06/2024, 3:28 PMsavepoint after you suspend a job and upon restart ignores the initialSavepointPath and restores from the last successful savepoint.
You will have to specify the initialSavepointPath if you are starting a new job or if you are starting a job after deleting the last one.Prithvi Dammalapati
02/06/2024, 5:37 PMupgradeMode:savepoint
https://apache-flink.slack.com/archives/C03G7LJTS2G/p1706622931936909Rion Williams
02/07/2024, 5:25 PMjob:
initialSavepointPath: {{ $storage.baseUri }}/my-predetermined-path/
savepointRedeployNonce: 0
Is there any way to ignore this? Basically if the savepoint exists, use it, otherwise just continue sans state?Rion Williams
02/07/2024, 5:25 PMPrithvi Dammalapati
02/07/2024, 6:23 PMinitialSavepointPath is not set, correct?