-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Enable REPLACE INTO engine and Fix Foreign key locking issue #14532
Merged
Conversation
This file contains 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
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
vitess-bot
bot
added
NeedsDescriptionUpdate
The description is not clear or comprehensive enough, and needs work
NeedsIssue
A linked issue is missing for this Pull Request
NeedsWebsiteDocsUpdate
What it says
labels
Nov 16, 2023
harshit-gangal
force-pushed
the
replace-plan
branch
from
November 16, 2023 12:08
63e3a93
to
bc62c41
Compare
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
…er tests Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
harshit-gangal
force-pushed
the
replace-plan
branch
from
November 16, 2023 15:51
bc62c41
to
646e44b
Compare
harshit-gangal
removed
NeedsWebsiteDocsUpdate
What it says
NeedsIssue
A linked issue is missing for this Pull Request
NeedsDescriptionUpdate
The description is not clear or comprehensive enough, and needs work
labels
Nov 16, 2023
Signed-off-by: Harshit Gangal <[email protected]>
harshit-gangal
requested review from
systay,
frouioui,
GuptaManan100,
arthurschreiber and
deepthi
as code owners
November 16, 2023 19:19
GuptaManan100
approved these changes
Nov 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM!
Signed-off-by: Harshit Gangal <[email protected]>
harshit-gangal
force-pushed
the
replace-plan
branch
from
November 20, 2023 05:00
2614ea1
to
10a7424
Compare
Signed-off-by: Shlomi Noach <[email protected]>
systay
reviewed
Nov 20, 2023
systay
approved these changes
Nov 20, 2023
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
deepthi
changed the title
Enable
Enable REPLACE INTO engine and Fix Foreign key locking issue
Nov 21, 2023
Replace Into
engine and Fix Foreign key locking issue
ejortegau
pushed a commit
to slackhq/vitess
that referenced
this pull request
Dec 13, 2023
…sio#14532) Signed-off-by: Harshit Gangal <[email protected]> Signed-off-by: Shlomi Noach <[email protected]> Co-authored-by: Shlomi Noach <[email protected]>
4 tasks
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.
Description
While adding REPLACE INTO support for foreign keys in unsharded tables, we discovered that select queries executed for foreign key cascade were not able to acquire an adequate level of lock on the unique key due to missing gap locks. This led to incorrect results, and further plan execution would result in missing cascading rows, leading to incomplete data in the binary logs.
VReplication workflow relies on these binary logs for tasks like online-ddl or change log streaming.
Example case:
To address the issue of blocked queries not providing updated results, we tried several techniques:
These methods worked with two threads but led to incorrect/missing binary logs in a multi-threaded system.
As a solution, we're using the NOWAIT lock to promptly acquire the lock for cascade selection. NOWAIT ensures immediate lock acquisition or failure, which may result in more foreign key-related DMLs failing, necessitating query or transaction rollback. This approach, however, effectively addresses the problem of lock waiting and prevents incorrect results.
Related Issue(s)
Checklist