-
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
VReplication VPlayer: support statement and transaction batching #14502
Conversation
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
|
e72a899
to
45239f9
Compare
c858006
to
9af3f4a
Compare
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
…w change Signed-off-by: Rohit Nayak <[email protected]>
a782bb7
to
5067148
Compare
Signed-off-by: Rohit Nayak <[email protected]>
…s not causing regressions Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
return nil, nil | ||
} | ||
if (len(tp.TablePlanBuilder.pkCols) + len(tp.TablePlanBuilder.extraSourcePkCols)) != 1 { | ||
return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "bulk delete is only supported for tables with a single primary key column") |
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.
We don't want to extend this here for composite primary keys? Or is that for a separate PR?
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.
I planned to punt on that until later, but I can take a stab at it. I think I'd prefer using OR groups. Maybe it will be easy....
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.
Added a TODO for now. That would require much more testing as the performance of those DELETEs can be unexpected based on past experience. That concern may not be warranted anymore with 8.0+, but for a related recent example with MariaDB:
https://jira.mariadb.org/browse/MDEV-32878
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
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.
LGTM, 💯
The VReplication FK Stress test is failing, most likely not related to the PR functionality.
go/vt/vttablet/tabletmanager/vreplication/vplayer_flaky_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
… (#1647) Signed-off-by: Matt Lord <[email protected]>
…essio#14502) Signed-off-by: Matt Lord <[email protected]> Signed-off-by: Rohit Nayak <[email protected]> Co-authored-by: Rohit Nayak <[email protected]>
Description
When there is a bulk
DELETE
on thesource
, thetarget
sees a stream of row changes, each of which is aDELETE
. Currently we run each of theseDELETE
s as an individual query. So if there are a thousand (say) rows deleted because of a singleDELETE
statement, we will run a thousand individualDELETE
s on thetarget
. This is wasteful in performance and can result in a large vreplication lag for clusters with a high QPS and frequent bulkDELETE
s (in particular when using external tablets or tablets with otherwise high latency connections to the mysqld). This PR identifies such transactions and coalesces these statements usingIN
resulting in a singleDELETE
statement for the case mentioned above (currently limited to tables with single column Primary Keys).Similarly, when there is a bulk
INSERT
on thesource
we now batch those into a single statement with multiple values tuples on thetarget
.Lastly, we batch all of the final transaction's statements together in a single multi-statement MySQL protocol message when we want to
commit
.This functionality is opt-in using the
--vreplication_experimental_flags
approach. A new bitmaskVReplicationExperimentalFlagVPlayerBatching
=4 (0x100)
needs to be set to enable it. It is disabled by default.Related Issue(s)
Checklist