Skip to content

passthrough DML option#3564

Merged
sougou merged 3 commits intovitessio:masterfrom
tinyspeck:queryserver-passthrough-dmls
Jan 23, 2018
Merged

passthrough DML option#3564
sougou merged 3 commits intovitessio:masterfrom
tinyspeck:queryserver-passthrough-dmls

Conversation

@demmer
Copy link
Copy Markdown
Member

@demmer demmer commented Jan 19, 2018

Add a vttablet flag -queryserver-config-passthrough-dmls that disables rewriting for update/delete DMLs and passes through queries straight through to mysql in both SBR and RBR mode.

Rather than use a new plan type, this just reuses the existing PlanPassDML and disables the check which rejects those clauses in SBR mode.

When PassthroughDMLs is set, then all update or delete queries are
returned as PlanPassDML regardless of query type.
Add a flag to the queryserver config that both configures the
planbuilder to use PlanPassDML for all plans and allows those plans
to execute even in statement based replication.
@demmer demmer requested a review from sougou January 19, 2018 04:51
switch qre.plan.PlanID {
case planbuilder.PlanPassDML:
if qre.tsv.qe.binlogFormat != connpool.BinlogFormatRow {
if !qre.tsv.qe.passthroughDMLs.Get() && (qre.tsv.qe.binlogFormat != connpool.BinlogFormatRow) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, vttablet should disallow any pass-through query for SBR, and we should add a separate override for vtqueryserver.

It may actually be better to fail early on this: QueryEngine calls VerifyMode on Open. If the flag is on, and we are not RBR, we can return an error there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the separate option.

Failing early seems like a nice to have but not necessary optimization.

Since PlanPassDML executions are fundamentally unsafe in SBR mode,
they should not be allowed unless the user explicitly wants to
enable them, so add a separate flag which is not exposed in a command
line flag (but will be in vtqueryserver) to allow the unsafe
statements when in SBR mode.
@sougou
Copy link
Copy Markdown
Contributor

sougou commented Jan 23, 2018

LGTM

Approved with PullApprove

@sougou sougou merged commit 787ad0d into vitessio:master Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants