Repository navigation
Conversation
…racle * Lock the MERGE target of the emulated "on conflict" upsert on SQL Server Without a lock hint, two concurrent upserts of the same new key could both take "when not matched", and one failed with a primary key violation (2627). Add HOLDLOCK to the MERGE target. * Make the emulated "on conflict" upserts race-free on Oracle MERGE reads the target with a consistent read, so a concurrent insert of the same key made it fail with ORA-00001. Render "do nothing" as an INSERT with the IGNORE_ROW_ON_DUPKEY_INDEX hint, and replace the conditional "do update ... where expired" upserts of single-use objects and revoked tokens with "delete if expired, then insert do nothing". (cherry picked from commit f80eb3b) Signed-off-by: Semih702 <semih702do@gmail.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com> Co-authored-by: Alexander Schwartz <alexander.schwartz@ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without a lock hint, two concurrent upserts of the same new key could
both take "when not matched", and one failed with a primary key
violation (2627). Add HOLDLOCK to the MERGE target.
MERGE reads the target with a consistent read, so a concurrent insert of
the same key made it fail with ORA-00001. Render "do nothing" as an
INSERT with the IGNORE_ROW_ON_DUPKEY_INDEX hint, and replace the
conditional "do update ... where expired" upserts of single-use objects
and revoked tokens with "delete if expired, then insert do nothing".
(cherry picked from commit f80eb3b)