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

[core] Introduce ExpireChangelogImpl to handle the changelog lifecycle #2942

Closed
wants to merge 3 commits into from

Conversation

Aitozi
Copy link
Contributor

@Aitozi Aitozi commented Mar 5, 2024

Purpose

Linked issue: close #2899

In this PR, the snapshot will be moved to the /changelog directory for decouple the changelog lifecycle. We will always keep one extra metadata file in the /changelog directory for the conveniency of streaming scan.

Tests

API and Format

Documentation

@Aitozi Aitozi force-pushed the changelog-lifecycle branch from da737dd to b020e1f Compare March 5, 2024 06:54
@Aitozi Aitozi requested a review from JingsongLi March 5, 2024 08:10
// move snapshot metadata to changelog
try {
snapshotManager.moveToChangelog(id);
snapshotManager.commitLongLivedChangelogLatestHint(id);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should not just move snapshot file.

We could introduce a new JSON file for changelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, I've not seen the requirement to introduce a new metadata structure for changelog. We can rewrite the content later when we have to later.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we have to do it later, it is hard to keep forward compatibility.

It is better to provide a simple version now.

snapshotManager.fileIO().deleteQuietly(snapshotManager.snapshotPath(id));
// move snapshot metadata to changelog
try {
snapshotManager.moveToChangelog(id);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please note that it is best not to affect the original behavior. For example, here we should determine whether there is a separate configuration for the changelog lifecycle. If it is not configured or is the same as the snapshot lifecycle, we should avoid creating files in the changelog folder.

LOG.debug("Ready to delete changelog files from snapshot #" + id);
}
Snapshot snapshot = snapshotManager.snapshot(id);
if (snapshot.changelogManifestList() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If possible, we should try to ensure that the delta file of the Append snapshot can be stream read when there is no changelog file present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, will give a try.

@Aitozi Aitozi marked this pull request as draft March 19, 2024 09:44
@Aitozi Aitozi closed this Mar 19, 2024
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.

[Feature] Decouple the lifecycle of snapshot and changelog
2 participants