Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-36110][snapshot] Store periodic snapshot trigger timestamps in memory #868

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

mateczagany
Copy link
Contributor

What is the purpose of the change

SnapshotObserver uses deprecated fields as the latest timestamp of triggered snapshots. These fields are not updated when using FlinkStateSnapshot though. This new method of storing these timestamps is meant to fix this case.

Brief change log

  • Add new class to store/retrieve last timestamp a snapshot was triggered
  • Updated relevant code to store/retrieve last timestamp in new class

Verifying this change

  • Added unit tests
  • Manual testing

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changes to the CustomResourceDescriptors: no
  • Core observer or reconciler logic that is regularly executed: yes

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Comment on lines 81 to 92
.orElseGet(
() -> {
var legacyTs = getLegacyTimestamp(resource, snapshotType);
var creationTs =
Instant.parse(resource.getMetadata().getCreationTimestamp());

if (legacyTs.compareTo(creationTs) > 0) {
return legacyTs;
} else {
return creationTs;
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put into the cache before returning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea, with this change we won't unnecessarily call the supplier if we don't trigger a periodic snapshot in AbstractJobReconciler.

@gyfora gyfora merged commit 0ef627e into apache:main Aug 23, 2024
169 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants