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

Generate idempotent SQL for SaveChanges when retrying a commit failure #10119

Open
Tracked by #22947 ...
AndriySvyryd opened this issue Oct 19, 2017 · 4 comments
Open
Tracked by #22947 ...

Comments

@AndriySvyryd
Copy link
Member

AndriySvyryd commented Oct 19, 2017

If the entity has client-generated key or concurrency token we could generate idempotent commands to make commit failure handling easier.
For updates without concurrency tokens we can use one of the changed values.

@AndriySvyryd
Copy link
Member Author

Related to #4526

@roji
Copy link
Member

roji commented Oct 20, 2022

@AndriySvyryd can you please write a sentence or two on what this means?

@AndriySvyryd AndriySvyryd changed the title Generate idempotent SQL for inserts Generate idempotent SQL for SaveChanges when retrying a commit failure Oct 20, 2022
@AndriySvyryd
Copy link
Member Author

This is about dealing with transient failures during transaction commit. Retrying the operation again could result in an exception if it did succeed. Arguably the worst case is when inserting rows with store-generated keys as then the operation can be executed twice causing data corruption.
But even in that case we can leverage the values generated during the last attempt and use them in a condition when retrying, so that the operation will be noop if the last attempt succeeded.

@roji
Copy link
Member

roji commented Oct 20, 2022

To clarify for myself: this is about a transient failure during the transaction commit itself, so we have no idea whether the transaction committed or not.

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

No branches or pull requests

3 participants