Skip to content

Commit

Permalink
[Improve] trigger savepoint bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjobs committed Mar 6, 2024
1 parent 03fffda commit a4f64c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ private void handleSavepointResponseFuture(
savepointResponse -> {
if (savepointResponse != null && savepointResponse.savePointDir() != null) {
applicationLog.setSuccess(true);
flinkAppHttpWatcher.cleanSavepoint(application);
String savePointDir = savepointResponse.savePointDir();
log.info("Request savepoint successful, savepointDir: {}", savePointDir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ private void doPersistMetrics(Application application, boolean stopWatch) {
} else {
WATCHING_APPS.put(appId, application);
}

StateChangeEvent event = PREVIOUS_STATUS.getIfPresent(appId);
StateChangeEvent nowEvent = StateChangeEvent.of(application);
if (!nowEvent.equals(event)) {
Expand Down Expand Up @@ -617,8 +618,12 @@ private void cleanOptioning(OptionState optionState, Long key) {
}

public void cleanSavepoint(Application application) {
SAVEPOINT_CACHE.invalidate(application.getId());
application.setOptionState(OptionState.NONE.getValue());
StateChangeEvent event = PREVIOUS_STATUS.getIfPresent(application.getId());
if (event != null && event.getOptionState() == OptionState.SAVEPOINTING) {
doPersistMetrics(application, false);
}
SAVEPOINT_CACHE.invalidate(application.getId());
}

/** set current option state */
Expand Down Expand Up @@ -648,6 +653,13 @@ public static void addSavepoint(Long appId) {
}
log.info("[StreamPark][FlinkAppHttpWatcher] add app to savepoint,appId:{}", appId);
SAVEPOINT_CACHE.put(appId, DEFAULT_FLAG_BYTE);

// update to PREVIOUS_STATUS
StateChangeEvent event = PREVIOUS_STATUS.getIfPresent(appId);
if (event != null) {
event.setOptionState(OptionState.SAVEPOINTING);
PREVIOUS_STATUS.put(appId, event);
}
}

public static void unWatching(Long appId) {
Expand Down

0 comments on commit a4f64c2

Please sign in to comment.