Skip to content

Fix DDL Execution on reserved connection without in active transaction#6514

Merged
harshit-gangal merged 4 commits intovitessio:masterfrom
planetscale:fix-ddl-onreservedconn
Aug 10, 2020
Merged

Fix DDL Execution on reserved connection without in active transaction#6514
harshit-gangal merged 4 commits intovitessio:masterfrom
planetscale:fix-ddl-onreservedconn

Conversation

@harshit-gangal
Copy link
Member

@harshit-gangal harshit-gangal commented Jul 31, 2020

When in transaction on DDL execution we create a new transaction on the same connection before returning the result back to vtgate.
Reserved connection uses same connection. But, they may or may not be in active transaction. This caused the ddl exec to break in reserved connection.

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Copy link
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

You can merge after removing the TODO.

if err != nil {
return nil, err
// Only perform this operation when the connection has transaction open.
// TODO: This actually does not retain the old transaction. We should see how to provide correct behaviour to client.
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove the TODO. The DDL specs say that it's an implicit commit. So, this is correct behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea here it to not start a new transaction as the current existing transaction is committed. Instead VTGate session should clear out transaction details it is holding.

@harshit-gangal harshit-gangal merged commit 02cb34d into vitessio:master Aug 10, 2020
@deepthi
Copy link
Collaborator

deepthi commented Aug 11, 2020

Please create a backport PR for 7.0.

@deepthi deepthi modified the milestone: 7.0.1 Aug 11, 2020
harshit-gangal added a commit to planetscale/vitess that referenced this pull request Aug 12, 2020
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
deepthi added a commit that referenced this pull request Aug 12, 2020
@askdba askdba added this to the v8.0 milestone Oct 5, 2020
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.

4 participants