Skip to content

Core: Commit state should be unknown even when new location is not in history#3717

Merged
rdblue merged 1 commit into
apache:masterfrom
jfz:missing-metadata-file
Dec 12, 2021
Merged

Core: Commit state should be unknown even when new location is not in history#3717
rdblue merged 1 commit into
apache:masterfrom
jfz:missing-metadata-file

Conversation

@jfz

@jfz jfz commented Dec 11, 2021

Copy link
Copy Markdown
Contributor

This PR fixes an issue where a commit succeeds but its metadata file is deleted and table is corrupted.

Currently when there's an exception during commit, we refresh table and check commit state by looking at if the new metadata location matches current or in history, and commit state is Failure if not, and the current metadata file is deleted.
There's a possibility that when the check happens, the metadata remote server (e.g. Hive metastore) is still processing the commit and eventually succeed later, in this case, the commit(atomic location swap) succeeds but metadata file is deleted, and the table is in bad state.
The commit state should be considered as unknown to avoid metadata being deleted, also the error propagated to user is more accurate.

@jfz jfz changed the title Commit state should be unknown even if current location is not in history Commit state should be unknown even if new location is not in history Dec 11, 2021
@jfz jfz changed the title Commit state should be unknown even if new location is not in history Core: commit state should be unknown even when new location is not in history Dec 12, 2021
@jfz jfz changed the title Core: commit state should be unknown even when new location is not in history Core: Commit state should be unknown even when new location is not in history Dec 12, 2021
@rdblue

rdblue commented Dec 12, 2021

Copy link
Copy Markdown
Contributor

I think this is correct. Another case is where the initial commit times out, but it succeeds on the server side, then another commit is successful. The metadata location would not match, but the commit was valid.

@RussellSpitzer, can you take a look at this as well? Good to get more than just one person looking at these.

@rdblue

rdblue commented Dec 12, 2021

Copy link
Copy Markdown
Contributor

Thanks for catching this, @jfz!

@RussellSpitzer RussellSpitzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch! I do think at the time we were discussing whether this should recurse backwards to check if the commit had succeeded in the past but settled on just checking current. I think you are absolutely correct that this is not a guarantee that the commit did not succeed, so Commit State Unknown is the right response

@rdblue rdblue merged commit 4c48df2 into apache:master Dec 12, 2021
@rdblue

rdblue commented Dec 12, 2021

Copy link
Copy Markdown
Contributor

Thanks, @jfz! And thanks for the additional review, @RussellSpitzer!

@jfz

jfz commented Dec 13, 2021

Copy link
Copy Markdown
Contributor Author

Thanks @rdblue and @RussellSpitzer for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants