Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
50691e09
Commit
50691e09
authored
Nov 19, 2020
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-21652 fixes
- fix lowercase - lcase2 fix - --ps-protocol fix
parent
4310cbfc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
21 deletions
+36
-21
mysql-test/suite/innodb/r/foreign_key_legacy.result
mysql-test/suite/innodb/r/foreign_key_legacy.result
+7
-19
mysql-test/suite/innodb/t/foreign_key_legacy.test
mysql-test/suite/innodb/t/foreign_key_legacy.test
+20
-0
sql/handler.cc
sql/handler.cc
+5
-0
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+4
-2
No files found.
mysql-test/suite/innodb/r/foreign_key_legacy.result
View file @
50691e09
...
...
@@ -29,8 +29,6 @@ t2 CREATE TABLE `t2` (
KEY `fk_t2` (`y`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`y`) REFERENCES `t1` (`x`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Warnings:
Error 1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
@@ -105,7 +103,7 @@ show create table t2;
ERROR HY000: Index for table 't2' is corrupt; try to repair it
show warnings;
Level Code Message
Error
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Note
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Warning 150 Upgrade table t2 with foreign key t2_ibfk_1 constraint failed. Foreign key index not found!
Error 1215 Cannot add foreign key constraint for `t2`
Error 1034 Index for table 't2' is corrupt; try to repair it
...
...
@@ -127,7 +125,7 @@ show create table t2;
ERROR HY000: Index for table 't2' is corrupt; try to repair it
show warnings;
Level Code Message
Error
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Note
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Warning 150 Upgrade table t2 with foreign key t2_ibfk_1 constraint failed. Referenced key index not found!
Error 1215 Cannot add foreign key constraint for `t2`
Error 1034 Index for table 't2' is corrupt; try to repair it
...
...
@@ -143,7 +141,7 @@ show create table t2;
ERROR HY000: Index for table 't2' is corrupt; try to repair it
show warnings;
Level Code Message
Error
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Note
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Warning 150 Upgrade table t2 with foreign key t2_ibfk_1 constraint failed. Foreign key index not found!
Error 1215 Cannot add foreign key constraint for `t2`
Error 1034 Index for table 't2' is corrupt; try to repair it
...
...
@@ -159,7 +157,7 @@ show create table t2;
ERROR HY000: Index for table 't2' is corrupt; try to repair it
show warnings;
Level Code Message
Error
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Note
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Warning 150 Upgrade table t2 with foreign key t2_ibfk_1 constraint failed. Referenced key index not found!
Error 1215 Cannot add foreign key constraint for `t2`
Error 1034 Index for table 't2' is corrupt; try to repair it
...
...
@@ -192,8 +190,6 @@ t2 CREATE TABLE `t2` (
KEY `fk_t2` (`y`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`y`) REFERENCES `t0` (`x`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Warnings:
Error 1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
@@ -222,8 +218,6 @@ t3 CREATE TABLE `t3` (
KEY `fk_t2` (`y`),
CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`y`) REFERENCES `t1` (`x`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Warnings:
Error 1459 Upgrade required. Please do "REPAIR TABLE `t3`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
@@ -253,8 +247,6 @@ t2 CREATE TABLE `t2` (
KEY `fk_t2` (`y`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`y`) REFERENCES `t0` (`x`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Warnings:
Error 1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
@@ -269,7 +261,7 @@ INSERT INTO SYS_FOREIGN VALUES ('test/t2_ibfk_1', 'test/t2', 'test/t1', 1);
INSERT INTO SYS_FOREIGN_COLS VALUES ('test/t2_ibfk_1', 0, 'y', 'x');";
alter table t2 rename t3;
Warnings:
Error
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Note
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
@@ -306,8 +298,6 @@ t2 CREATE TABLE `t2` (
KEY `fk_t2` (`y`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`y`) REFERENCES `t1` (`z`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Warnings:
Error 1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
@@ -322,7 +312,7 @@ INSERT INTO SYS_FOREIGN VALUES ('test/t2_ibfk_1', 'test/t2', 'test/t1', 1);
INSERT INTO SYS_FOREIGN_COLS VALUES ('test/t2_ibfk_1', 0, 'y', 'x');";
alter table t2 change y z int;
Warnings:
Error
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Note
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
@@ -359,8 +349,6 @@ t2 CREATE TABLE `t2` (
KEY `fk_t2` (`y`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`y`) REFERENCES `t1` (`z`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Warnings:
Error 1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
@@ -377,7 +365,7 @@ INSERT INTO SYS_FOREIGN VALUES ('test/t2_ibfk_1', 'test/t2', 'test/t1', 1);
INSERT INTO SYS_FOREIGN_COLS VALUES ('test/t2_ibfk_1', 0, 'y', 'x');";
alter table t2 rename column y to z;
Warnings:
Error
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
Note
1459 Upgrade required. Please do "REPAIR TABLE `t2`" or dump/reload to fix it!
select * from information_schema.innodb_sys_foreign;
ID FOR_NAME REF_NAME N_COLS TYPE
select * from information_schema.innodb_sys_foreign_cols;
...
...
mysql-test/suite/innodb/t/foreign_key_legacy.test
View file @
50691e09
...
...
@@ -22,7 +22,10 @@ select * from information_schema.innodb_sys_foreign;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
flush
tables
;
--
echo
# Data is imported from SYS_FOREIGN[_COLS] on table open
# Warnings doesn't appear in SHOW CREATE TABLE under ps-protocol
--
disable_warnings
show
create
table
t2
;
--
enable_warnings
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
...
...
@@ -154,7 +157,9 @@ rename table t1 to t0;
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
--
disable_warnings
show
create
table
t2
;
--
enable_warnings
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
...
...
@@ -176,7 +181,9 @@ rename table t2 to t3;
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
--
disable_warnings
show
create
table
t3
;
--
enable_warnings
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
...
...
@@ -200,7 +207,9 @@ alter table t1 rename t0;
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
--
disable_warnings
show
create
table
t2
;
--
enable_warnings
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
...
...
@@ -240,7 +249,9 @@ alter table t1 change x z int;
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
--
disable_warnings
show
create
table
t2
;
--
enable_warnings
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
drop
tables
t2
,
t1
;
...
...
@@ -259,7 +270,9 @@ alter table t2 change y z int;
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
--
disable_warnings
show
create
table
t2
;
--
enable_warnings
--
error
ER_ROW_IS_REFERENCED_2
drop
table
t1
;
drop
tables
t2
,
t1
;
...
...
@@ -279,7 +292,10 @@ alter table t1 rename column x to z;
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
--
disable_warnings
show
create
table
t2
;
--
enable_warnings
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
--
error
ER_ROW_IS_REFERENCED_2
...
...
@@ -300,7 +316,10 @@ alter table t2 rename column y to z;
select
*
from
information_schema
.
innodb_sys_foreign
;
select
*
from
information_schema
.
innodb_sys_foreign_cols
;
--
disable_warnings
show
create
table
t2
;
--
enable_warnings
--
error
ER_ROW_IS_REFERENCED_2
drop
table
t1
;
drop
tables
t2
,
t1
;
...
...
@@ -331,6 +350,7 @@ select * from information_schema.innodb_sys_foreign_cols;
drop
table
t1
;
drop
tables
t2
,
t1
;
--
enable_warnings
set
session
debug_dbug
=
@
saved_debug_dbug
;
set
global
innodb_eval_sql
=
default
;
set
default_storage_engine
=
default
;
sql/handler.cc
View file @
50691e09
...
...
@@ -4153,6 +4153,11 @@ void handler::print_error(int error, myf errflag)
DBUG_VOID_RETURN
;
}
case
HA_ERR_FK_UPGRADE
:
if
(
!
ha_thd
()
->
transaction_rollback_request
)
{
/* Ensure this becomes a true error */
errflag
|=
(
ME_NOTE
);
}
/* fall through */
case
HA_ERR_TABLE_NEEDS_UPGRADE
:
textno
=
ER_TABLE_NEEDS_UPGRADE
;
...
...
storage/innobase/handler/ha_innodb.cc
View file @
50691e09
...
...
@@ -21248,7 +21248,7 @@ fk_upgrade_create_fk(
ut_a
(
fld
->
len
<=
MAX_FULL_NAME_LEN
);
memcpy
(
src_ref
,
fld
->
data
,
fld
->
len
);
src_ref
[
fld
->
len
]
=
0
;
if
(
lower_case_table_names
==
1
)
{
if
(
lower_case_table_names
)
{
innobase_casedn_str
(
src_ref
);
}
memcpy
(
d
.
ref_name
,
src_ref
,
fld
->
len
+
1
);
...
...
@@ -21386,6 +21386,7 @@ fk_upgrade_push_fk(
ut_ad
(
fk
.
foreign_fields
.
elements
<
MAX_NUM_FK_COLUMNS
);
ut_ad
(
fk
.
foreign_fields
.
elements
==
fk
.
referenced_fields
.
elements
);
uint
i
=
0
;
char
norm_name
[
FN_REFLEN
];
const
char
*
column_names
[
MAX_NUM_FK_COLUMNS
];
const
char
*
ref_column_names
[
MAX_NUM_FK_COLUMNS
];
dict_index_t
*
index
;
...
...
@@ -21408,7 +21409,8 @@ fk_upgrade_push_fk(
d
.
err
=
DB_CANNOT_ADD_CONSTRAINT
;
return
0
;
}
dict_table_t
*
ref_table
=
dict_table_open_on_name
(
d
.
ref_name
,
true
,
false
,
DICT_ERR_IGNORE_FK_NOKEY
);
normalize_table_name
(
norm_name
,
d
.
ref_name
);
dict_table_t
*
ref_table
=
dict_table_open_on_name
(
norm_name
,
true
,
false
,
DICT_ERR_IGNORE_FK_NOKEY
);
if
(
!
ref_table
)
{
mutex_exit
(
&
dict_sys
.
mutex
);
ib_foreign_warn
(
d
.
trx
,
DB_CANNOT_ADD_CONSTRAINT
,
d
.
s
->
table_name
.
str
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment