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: delete temp metadata file when version already exists #11350

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,13 @@ private void renameToFinal(FileSystem fs, Path src, Path dst, int nextVersion) {
}

if (fs.exists(dst)) {
throw new CommitFailedException("Version %d already exists: %s", nextVersion, dst);
CommitFailedException cfe =
new CommitFailedException("Version %d already exists: %s", nextVersion, dst);
RuntimeException re = tryDelete(src);
Copy link
Contributor

Choose a reason for hiding this comment

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

is it always correct to delete the src file or could there be cases where we'd want to keep it?

Copy link
Author

Choose a reason for hiding this comment

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

@nastra yes, i think it is always safe to delete the temp src file(temp metadata file), the commit retry would create a new temp metadata file.

if (re != null) {
cfe.addSuppressed(re);
}
throw cfe;
}

if (!fs.rename(src, dst)) {
Expand Down