Skip to content
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

ddl: support multi-table statements #4327

Merged
merged 1 commit into from
Nov 4, 2018

Conversation

sougou
Copy link
Contributor

@sougou sougou commented Oct 30, 2018

rename and drop allow multiple tables in the DDL.
This change adds support for them.

  • Introduced two new members to DDL: 'from' and 'to' table lists.
  • NewName is deprecated.
  • For single table DDLs, only Table is set.
  • For multi-table DDLs, 'from' and 'to' tables are set as needed.
  • The vttablet ddl plan had unused fields. They've been deleted.
  • The permissions code has been updated to use the new table names.

Signed-off-by: Sugu Sougoumarane ssougou@gmail.com

rename and drop allow multiple tables in the DDL.
This change adds support for them.

* Introduced two new members to DDL: 'from' and 'to' table lists.
* NewName is deprecated.
* For single table DDLs, only Table is set.
* For multi-table DDLs, 'from' and 'to' tables are set as needed.
* The vttablet ddl plan had unused fields. They've been deleted.
* The permissions code has been updated to use the new table names.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
@sougou sougou requested a review from demmer October 30, 2018 17:48
@sougou
Copy link
Contributor Author

sougou commented Oct 30, 2018

@slanning you may also review this.

Copy link
Contributor

@slanning slanning left a comment

Choose a reason for hiding this comment

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

I didn't manage to break it yet, so looks good to me.

deepthi
deepthi previously requested changes Nov 1, 2018
data/test/tabletserver/ddl_cases.txt Show resolved Hide resolved
data/test/tabletserver/ddl_cases.txt Show resolved Hide resolved
@sougou
Copy link
Contributor Author

sougou commented Nov 1, 2018

These JSONs are not for ast.DDL. They're for planbuilder.DDLPlan: https://github.com/vitessio/vitess/blob/master/go/vt/vttablet/tabletserver/planbuilder/ddl.go#L24.

Basically, DDLPlan used to have TableName and NewTable, but they were unused. So, I removed them. That leaves it with Action as the only member. In a previous life, vttablet used to conditionally load/unload schema info for those tables. But now, it just passes the DDL through. So, it doesn't need to know the table names any more.

In a way, even Action is mostly ignored, but there's one flow where an empty action is treated as an error: https://github.com/vitessio/vitess/blob/master/go/vt/vttablet/tabletserver/query_executor.go#L394.

As to why it accepts "XYZ": "b": it's because JSON is permissive. It just ignores unmatched fields.

@deepthi deepthi dismissed their stale review November 1, 2018 20:16

No changes needed

@sougou sougou merged commit bde5ab2 into vitessio:master Nov 4, 2018
@slanning slanning mentioned this pull request Nov 9, 2018
@sougou sougou deleted the ss-multi-ddl branch November 18, 2018 17:49
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