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: Commit state should be unknown even when new location is not in history #3717

Merged
merged 1 commit into from Dec 12, 2021

Conversation

jfz
Copy link
Contributor

@jfz jfz commented Dec 11, 2021

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
Copy link
Contributor

rdblue commented Dec 12, 2021

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
Copy link
Contributor

rdblue commented Dec 12, 2021

Thanks for catching this, @jfz!

Copy link
Member

@RussellSpitzer RussellSpitzer left a comment

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
Copy link
Contributor

rdblue commented Dec 12, 2021

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

@jfz
Copy link
Contributor Author

jfz commented Dec 13, 2021

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.

None yet

3 participants