-
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
Online DDL: edit CONSTRAINT names in CREATE TABLE #14517
Online DDL: edit CONSTRAINT names in CREATE TABLE #14517
Conversation
Signed-off-by: Shlomi Noach <[email protected]>
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
|
… on 8.0.16 and above Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
newCreateTable := sqlparser.CloneRefOfCreateTable(originalCreateTable) | ||
// Rewrite this CREATE TABLE statement such that CONSTRAINT names are edited, | ||
// specifically removing any <tablename> prefix. | ||
if _, err := e.validateAndEditCreateTableStatement(ctx, onlineDDL, newCreateTable); err != nil { |
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.
unrelated to this PR, but why do we pass a context to this function? Functions that don't perform RPCs do not need to take in a context.
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.
This specific function indeed doesn't use the given context
. There's many other non-gRPC functions that do use a context
because they either use a Conn
ection (context cancellation ensures connection terminates) or loops/waits.
Signed-off-by: Shlomi Noach <[email protected]>
Description
Followup to #10638 and #14385, this PR edits a
CREATE TABLE
statement, to remove the table-name prefix from existing constraint names. This is so as to make the constraint name a non-generated one. The reasoning is to avoid https://bugs.mysql.com/bug.php?id=107772e.g. if some issues:
Then MySQL auto generates a constraint name, and the
CREATE TABLE
statement becomes:However, Online DDL intercepts the name
mytable_chk_1
, identifies that it begins withmytable_chk_
, and converts it to something likechk_crq6muar52qehxxi5wmd4fj5y
.Related Issue(s)
https://bugs.mysql.com/bug.php?id=107772
Checklist
Deployment Notes