SteNicholas commented on a change in pull request #38:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/38#discussion_r821486359
##########
File path:
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/observer/Observer.java
##########
@@ -129,13 +135,54 @@ private boolean observeFlinkJobStatus(FlinkDeployment
flinkApp, Configuration ef
}
}
+ private boolean observeSavepointStatus(
+ FlinkDeployment flinkApp, Configuration effectiveConfig) {
+ SavepointInfo savepointInfo =
flinkApp.getStatus().getJobStatus().getSavepointInfo();
+ if (savepointInfo.getTriggerId() == null) {
+ LOG.debug("Checkpointing not in progress");
+ return true;
+ }
+ SavepointFetchResult savepointFetchResult;
+ try {
+ savepointFetchResult = flinkService.fetchSavepointInfo(flinkApp,
effectiveConfig);
+ } catch (Exception e) {
+ LOG.error("Exception while fetching savepoint info", e);
+ return false;
+ }
+
+ if (!savepointFetchResult.isTriggered()) {
+ String error = savepointFetchResult.getError();
+ if (error != null
+ || SavepointUtils.gracePeriodEnded(operatorConfiguration,
savepointInfo)) {
+ LOG.error("Savepoint trigger failure, setting reconciliation
error");
+ savepointInfo.setTriggerId(null);
+ ReconciliationUtils.updateForReconciliationError(
+ flinkApp, error != null ? error : "Savepoint status
unknown");
+ return false;
+ }
+ LOG.info("Savepoint operation not running, waiting within grace
period");
+ }
+ if (savepointFetchResult.getSavepoint() == null) {
+ LOG.info("Savepoint not completed yet");
+ return false;
+ }
+
+ savepointInfo.setLastSavepoint(savepointFetchResult.getSavepoint());
+ savepointInfo.setTriggerId(null);
+ return true;
+ }
+
private boolean isReadyToReconcile(FlinkDeployment flinkApp, Configuration
effectiveConfig) {
JobManagerDeploymentStatus jmDeploymentStatus =
flinkApp.getStatus().getJobManagerDeploymentStatus();
switch (jmDeploymentStatus) {
case READY:
- return observeFlinkJobStatus(flinkApp, effectiveConfig);
+ boolean clusterStable = observeFlinkJobStatus(flinkApp,
effectiveConfig);
Review comment:
Does this be simplified as follows:
```
return observeFlinkJobStatus(flinkApp, effectiveConfig) &&
observeSavepointStatus(flinkApp, effectiveConfig);
```
--
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]