-
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
Remove ALGORITHM=COPY
from Online DDL in MySQL >= 8.0.32
#15376
Changes from all commits
4a19019
fb39081
d13a1de
f0fb98e
e4fceeb
f87bb76
59c8169
0bf8de5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
modify parent_id int not null |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
set session foreign_key_checks=0; | ||
drop table if exists onlineddl_test_child; | ||
drop table if exists onlineddl_test; | ||
drop table if exists onlineddl_test_parent; | ||
set session foreign_key_checks=1; | ||
create table onlineddl_test_parent ( | ||
id int auto_increment, | ||
primary key(id) | ||
); | ||
create table onlineddl_test ( | ||
id int auto_increment, | ||
parent_id int null, | ||
primary key(id), | ||
constraint test_fk foreign key (parent_id) references onlineddl_test_parent (id) on delete no action | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--unsafe-allow-foreign-keys |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We introduce this flag file because vanilla MySQL, used by this test, cannot run foreign-key Online DDLs. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -424,6 +424,18 @@ func TestInvalidSchema(t *testing.T) { | |
schema: "create table t10(id bigint primary key); create table t11 (id int primary key, i varchar(100), key ix(i), constraint f10 foreign key (i) references t10(id) on delete restrict)", | ||
expectErr: &ForeignKeyColumnTypeMismatchError{Table: "t11", Constraint: "f10", Column: "i", ReferencedTable: "t10", ReferencedColumn: "id"}, | ||
}, | ||
{ | ||
schema: "create table t10(id int primary key, pid int null, key (pid)); create table t11 (id int primary key, pid int unsigned, key ix(pid), constraint f10 foreign key (pid) references t10(pid))", | ||
expectErr: &ForeignKeyColumnTypeMismatchError{Table: "t11", Constraint: "f10", Column: "pid", ReferencedTable: "t10", ReferencedColumn: "pid"}, | ||
}, | ||
{ | ||
// NULL vs NOT NULL should be fine | ||
schema: "create table t10(id int primary key, pid int null, key (pid)); create table t11 (id int primary key, pid int not null, key ix(pid), constraint f10 foreign key (pid) references t10(pid))", | ||
}, | ||
{ | ||
// NOT NULL vs NULL should be fine | ||
schema: "create table t10(id int primary key, pid int not null, key (pid)); create table t11 (id int primary key, pid int null, key ix(pid), constraint f10 foreign key (pid) references t10(pid))", | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes here merely validate that as far as |
||
{ | ||
// InnoDB allows different string length | ||
schema: "create table t10(id varchar(50) primary key); create table t11 (id int primary key, i varchar(100), key ix(i), constraint f10 foreign key (i) references t10(id) on delete restrict)", | ||
|
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.
Can we instead use
mysqlctl.GetVersionString()
here and check for the PS fork indicator in the string?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.
That's what https://github.com/vitessio/vitess/pull/15376/files#diff-5b2f7e26e6a031b4098461528dca98e5ff630e70e1986f35efaab59f3fa5bd76R137-R156 does (not using
version()
but using variables). The intent of the flag file is to point out that this specific test should only run wherepreserve_foreign_key
is supported. We can't automatically associate a specific test with this specific restriction.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.
Run it