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

Nessie: Fix possible table-metadata loss #8413

Merged
merged 1 commit into from
Aug 29, 2023
Merged

Conversation

snazy
Copy link
Member

@snazy snazy commented Aug 29, 2023

NessieTableOperations.doCommit() wrongly assumes that every exception thrown during a Nessie commit operation is a failure that requires the deletion of the newly written table-metadata. However, for exceptions like j.l.InterruptedException or HTTP timeout/error it is unclear whether the Nessie commit went through (or will go through), so deleting the table-metadata is wrong here.

This change updates the logic to only delete the table-metadata file if a NessieReferenceConflictException happened, when it is clear that the commit really failed.

@@ -153,13 +153,12 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
// to catch all kinds of network errors (e.g. connection reset). Network code implementation
// details and all kinds of network devices can induce unexpected behavior. So better be
// safe than sorry.
delete = false;
throw new CommitStateUnknownException(ex);
} catch (NessieNotFoundException ex) {
throw new RuntimeException(
Copy link
Member

Choose a reason for hiding this comment

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

we can delete in this case also right? As it is definitely a failure to commit?

`NessieTableOperations.doCommit()` wrongly assumes that _every_ exception thrown during a Nessie commit operation is a failure that requires the deletion of the newly written table-metadata. However, for exceptions like `j.l.InterruptedException` or HTTP timeout/error it is unclear whether the Nessie commit went through (or will go through), so deleting the table-metadata is wrong here.

This change updates the logic to only delete the table-metadata file if a `NessieReferenceConflictException` happened, when it is clear that the commit really failed.
@nastra nastra merged commit e12ea75 into apache:master Aug 29, 2023
@snazy snazy deleted the fix-ie-issue branch August 30, 2023 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants