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
16bc9482
Commit
16bc9482
authored
Feb 19, 2019
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.1' of
https://github.com/mariadb/server
into 10.1
parents
32629670
346e4608
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
70 deletions
+62
-70
mysql-test/suite/innodb/r/foreign_key.result
mysql-test/suite/innodb/r/foreign_key.result
+13
-0
mysql-test/suite/innodb/t/foreign_key.test
mysql-test/suite/innodb/t/foreign_key.test
+12
-0
storage/innobase/dict/dict0dict.cc
storage/innobase/dict/dict0dict.cc
+17
-32
storage/maria/ma_delete.c
storage/maria/ma_delete.c
+0
-2
storage/maria/ma_write.c
storage/maria/ma_write.c
+1
-2
storage/maria/maria_def.h
storage/maria/maria_def.h
+2
-2
storage/xtradb/dict/dict0dict.cc
storage/xtradb/dict/dict0dict.cc
+17
-32
No files found.
mysql-test/suite/innodb/r/foreign_key.result
View file @
16bc9482
...
@@ -92,3 +92,16 @@ Warnings:
...
@@ -92,3 +92,16 @@ Warnings:
Warning 1088 failed to load FOREIGN KEY constraints
Warning 1088 failed to load FOREIGN KEY constraints
ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
DROP TABLE t1;
DROP TABLE t1;
#
# MDEV-18630 Conditional jump or move depends on uninitialised value
# in ib_push_warning / dict_create_foreign_constraints_low
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
ALTER IGNORE TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (b);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
SHOW WARNINGS;
Level Code Message
Warning 150 Alter table test/#sql-temporary with foreign key constraint failed. Referenced table `test`.`t2` not found in the data dictionary near 'FOREIGN KEY (a) REFERENCES t2 (b)'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
DROP TABLE t1;
mysql-test/suite/innodb/t/foreign_key.test
View file @
16bc9482
...
@@ -113,3 +113,15 @@ SET SESSION FOREIGN_KEY_CHECKS = ON;
...
@@ -113,3 +113,15 @@ SET SESSION FOREIGN_KEY_CHECKS = ON;
ALTER
TABLE
t1
ADD
FULLTEXT
INDEX
ft1
(
f
);
ALTER
TABLE
t1
ADD
FULLTEXT
INDEX
ft1
(
f
);
ALTER
TABLE
t1
ADD
FULLTEXT
INDEX
ft2
(
f
);
ALTER
TABLE
t1
ADD
FULLTEXT
INDEX
ft2
(
f
);
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-18630 Conditional jump or move depends on uninitialised value
--
echo
# in ib_push_warning / dict_create_foreign_constraints_low
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
InnoDB
;
--
replace_regex
/
#sql-[0-9_a-f-]*/#sql-temporary/
--
error
ER_CANT_CREATE_TABLE
ALTER
IGNORE
TABLE
t1
ADD
FOREIGN
KEY
(
a
)
REFERENCES
t2
(
b
);
--
replace_regex
/
#sql-[0-9_a-f-]*/#sql-temporary/
SHOW
WARNINGS
;
DROP
TABLE
t1
;
storage/innobase/dict/dict0dict.cc
View file @
16bc9482
...
@@ -4396,7 +4396,6 @@ dict_create_foreign_constraints_low(
...
@@ -4396,7 +4396,6 @@ dict_create_foreign_constraints_low(
const
char
*
create_table_name
;
const
char
*
create_table_name
;
const
char
*
orig
;
const
char
*
orig
;
char
create_name
[
MAX_TABLE_NAME_LEN
+
1
];
char
create_name
[
MAX_TABLE_NAME_LEN
+
1
];
char
operation
[
8
];
ut_ad
(
!
srv_read_only_mode
);
ut_ad
(
!
srv_read_only_mode
);
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
...
@@ -4407,41 +4406,33 @@ dict_create_foreign_constraints_low(
...
@@ -4407,41 +4406,33 @@ dict_create_foreign_constraints_low(
orig
=
ptr
;
orig
=
ptr
;
ptr
=
dict_accept
(
cs
,
ptr
,
"ALTER"
,
&
success
);
ptr
=
dict_accept
(
cs
,
ptr
,
"ALTER"
,
&
success
);
strcpy
((
char
*
)
operation
,
success
?
"Alter "
:
"Create "
)
;
const
char
*
const
operation
=
success
?
"Alter "
:
"Create "
;
if
(
!
success
)
{
if
(
!
success
)
{
orig
=
ptr
;
orig
=
ptr
;
ptr
=
dict_scan_to
(
ptr
,
"CREATE"
);
ptr
=
dict_scan_to
(
ptr
,
"CREATE"
);
ptr
=
dict_scan_to
(
ptr
,
"TABLE"
);
ptr
=
dict_scan_to
(
ptr
,
"TABLE"
);
ptr
=
dict_accept
(
cs
,
ptr
,
"TABLE"
,
&
success
);
ptr
=
dict_accept
(
cs
,
ptr
,
"TABLE"
,
&
success
);
create_table_name
=
NULL
;
if
(
success
)
{
if
(
success
)
{
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_create
,
name
,
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_create
,
name
,
&
success
,
heap
,
&
create_table_name
);
&
success
,
heap
,
&
create_table_name
);
}
}
if
(
success
)
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
create_table_name
,
strlen
(
create_table_name
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
ptr
=
orig
;
ptr
=
orig
;
const
char
*
n
=
create_table_name
?
create_table_name
:
name
;
char
*
bufend
=
innobase_convert_name
(
create_name
,
MAX_TABLE_NAME_LEN
,
n
,
strlen
(
n
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
else
{
}
else
{
char
*
bufend
;
strncpy
(
create_name
,
name
,
sizeof
create_name
);
ptr
=
orig
;
create_name
[(
sizeof
create_name
)
-
1
]
=
'\0'
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
name
,
strlen
(
name
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
goto
loop
;
}
}
if
(
table
==
NULL
)
{
if
(
table
==
NULL
)
{
mutex_enter
(
&
dict_foreign_err_mutex
);
mutex_enter
(
&
dict_foreign_err_mutex
);
dict_foreign_error_report_low
(
ef
,
create_name
);
dict_foreign_error_report_low
(
ef
,
create_name
);
dict_foreign_error_report_low
(
ef
,
create_name
);
fprintf
(
ef
,
"%s table %s with foreign key constraint"
fprintf
(
ef
,
"%s table %s with foreign key constraint"
" failed. Table %s not found from data dictionary."
" failed. Table %s not found from data dictionary."
" Error close to %s.
\n
"
,
" Error close to %s.
\n
"
,
...
@@ -4476,19 +4467,13 @@ dict_create_foreign_constraints_low(
...
@@ -4476,19 +4467,13 @@ dict_create_foreign_constraints_low(
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_alter
,
name
,
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_alter
,
name
,
&
success
,
heap
,
&
referenced_table_name
);
&
success
,
heap
,
&
referenced_table_name
);
if
(
table_to_alter
)
{
{
char
*
bufend
;
const
char
*
n
=
table_to_alter
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
?
table_to_alter
->
name
:
referenced_table_name
;
table_to_alter
->
name
,
strlen
(
table_to_alter
->
name
),
char
*
bufend
=
innobase_convert_name
(
trx
->
mysql_thd
,
TRUE
);
create_name
,
MAX_TABLE_NAME_LEN
,
n
,
strlen
(
n
),
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
else
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
referenced_table_name
,
strlen
(
referenced_table_name
),
trx
->
mysql_thd
,
TRUE
);
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
}
if
(
!
success
)
{
if
(
!
success
)
{
...
...
storage/maria/ma_delete.c
View file @
16bc9482
...
@@ -695,9 +695,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
...
@@ -695,9 +695,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
key_start
=
keypos
;
key_start
=
keypos
;
if
(
tmp_key
.
flag
&
(
SEARCH_USER_KEY_HAS_TRANSID
|
if
(
tmp_key
.
flag
&
(
SEARCH_USER_KEY_HAS_TRANSID
|
SEARCH_PAGE_KEY_HAS_TRANSID
))
SEARCH_PAGE_KEY_HAS_TRANSID
))
{
_ma_mark_page_with_transid
(
share
,
anc_page
);
_ma_mark_page_with_transid
(
share
,
anc_page
);
}
/* Save pointer to next leaf on parent page */
/* Save pointer to next leaf on parent page */
if
(
!
(
*
keyinfo
->
get_key
)(
&
ret_key
,
page_flag
,
share
->
base
.
key_reflength
,
if
(
!
(
*
keyinfo
->
get_key
)(
&
ret_key
,
page_flag
,
share
->
base
.
key_reflength
,
...
...
storage/maria/ma_write.c
View file @
16bc9482
...
@@ -843,9 +843,8 @@ int _ma_insert(register MARIA_HA *info, MARIA_KEY *key,
...
@@ -843,9 +843,8 @@ int _ma_insert(register MARIA_HA *info, MARIA_KEY *key,
a_length
+=
t_length
;
a_length
+=
t_length
;
if
(
key
->
flag
&
(
SEARCH_USER_KEY_HAS_TRANSID
|
SEARCH_PAGE_KEY_HAS_TRANSID
))
if
(
key
->
flag
&
(
SEARCH_USER_KEY_HAS_TRANSID
|
SEARCH_PAGE_KEY_HAS_TRANSID
))
{
_ma_mark_page_with_transid
(
share
,
anc_page
);
_ma_mark_page_with_transid
(
share
,
anc_page
);
}
anc_page
->
size
=
a_length
;
anc_page
->
size
=
a_length
;
page_store_size
(
share
,
anc_page
);
page_store_size
(
share
,
anc_page
);
...
...
storage/maria/maria_def.h
View file @
16bc9482
...
@@ -777,8 +777,8 @@ struct st_maria_handler
...
@@ -777,8 +777,8 @@ struct st_maria_handler
transid_korr((buff) + LSN_STORE_SIZE)
transid_korr((buff) + LSN_STORE_SIZE)
#define _ma_store_keypage_flag(share,x,flag) x[(share)->keypage_header - KEYPAGE_USED_SIZE - KEYPAGE_FLAG_SIZE]= (flag)
#define _ma_store_keypage_flag(share,x,flag) x[(share)->keypage_header - KEYPAGE_USED_SIZE - KEYPAGE_FLAG_SIZE]= (flag)
#define _ma_mark_page_with_transid(share, page) \
#define _ma_mark_page_with_transid(share, page) \
(page)->flag|= KEYPAGE_FLAG_HAS_TRANSID;
\
do { (page)->flag|= KEYPAGE_FLAG_HAS_TRANSID;
\
(page)->buff[(share)->keypage_header - KEYPAGE_USED_SIZE - KEYPAGE_FLAG_SIZE]= (page)->flag;
(page)->buff[(share)->keypage_header - KEYPAGE_USED_SIZE - KEYPAGE_FLAG_SIZE]= (page)->flag; } while (0)
#define KEYPAGE_KEY_VERSION(share, x) ((x) + \
#define KEYPAGE_KEY_VERSION(share, x) ((x) + \
(share)->keypage_header - \
(share)->keypage_header - \
...
...
storage/xtradb/dict/dict0dict.cc
View file @
16bc9482
...
@@ -4405,7 +4405,6 @@ dict_create_foreign_constraints_low(
...
@@ -4405,7 +4405,6 @@ dict_create_foreign_constraints_low(
const
char
*
create_table_name
;
const
char
*
create_table_name
;
const
char
*
orig
;
const
char
*
orig
;
char
create_name
[
MAX_TABLE_NAME_LEN
+
1
];
char
create_name
[
MAX_TABLE_NAME_LEN
+
1
];
char
operation
[
8
];
ut_ad
(
!
srv_read_only_mode
);
ut_ad
(
!
srv_read_only_mode
);
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
...
@@ -4416,41 +4415,33 @@ dict_create_foreign_constraints_low(
...
@@ -4416,41 +4415,33 @@ dict_create_foreign_constraints_low(
orig
=
ptr
;
orig
=
ptr
;
ptr
=
dict_accept
(
cs
,
ptr
,
"ALTER"
,
&
success
);
ptr
=
dict_accept
(
cs
,
ptr
,
"ALTER"
,
&
success
);
strcpy
((
char
*
)
operation
,
success
?
"Alter "
:
"Create "
)
;
const
char
*
const
operation
=
success
?
"Alter "
:
"Create "
;
if
(
!
success
)
{
if
(
!
success
)
{
orig
=
ptr
;
orig
=
ptr
;
ptr
=
dict_scan_to
(
ptr
,
"CREATE"
);
ptr
=
dict_scan_to
(
ptr
,
"CREATE"
);
ptr
=
dict_scan_to
(
ptr
,
"TABLE"
);
ptr
=
dict_scan_to
(
ptr
,
"TABLE"
);
ptr
=
dict_accept
(
cs
,
ptr
,
"TABLE"
,
&
success
);
ptr
=
dict_accept
(
cs
,
ptr
,
"TABLE"
,
&
success
);
create_table_name
=
NULL
;
if
(
success
)
{
if
(
success
)
{
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_create
,
name
,
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_create
,
name
,
&
success
,
heap
,
&
create_table_name
);
&
success
,
heap
,
&
create_table_name
);
}
}
if
(
success
)
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
create_table_name
,
strlen
(
create_table_name
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
ptr
=
orig
;
ptr
=
orig
;
const
char
*
n
=
create_table_name
?
create_table_name
:
name
;
char
*
bufend
=
innobase_convert_name
(
create_name
,
MAX_TABLE_NAME_LEN
,
n
,
strlen
(
n
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
else
{
}
else
{
char
*
bufend
;
strncpy
(
create_name
,
name
,
sizeof
create_name
);
ptr
=
orig
;
create_name
[(
sizeof
create_name
)
-
1
]
=
'\0'
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
name
,
strlen
(
name
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
goto
loop
;
}
}
if
(
table
==
NULL
)
{
if
(
table
==
NULL
)
{
mutex_enter
(
&
dict_foreign_err_mutex
);
mutex_enter
(
&
dict_foreign_err_mutex
);
dict_foreign_error_report_low
(
ef
,
create_name
);
dict_foreign_error_report_low
(
ef
,
create_name
);
dict_foreign_error_report_low
(
ef
,
create_name
);
fprintf
(
ef
,
"%s table %s with foreign key constraint"
fprintf
(
ef
,
"%s table %s with foreign key constraint"
" failed. Table %s not found from data dictionary."
" failed. Table %s not found from data dictionary."
" Error close to %s.
\n
"
,
" Error close to %s.
\n
"
,
...
@@ -4485,19 +4476,13 @@ dict_create_foreign_constraints_low(
...
@@ -4485,19 +4476,13 @@ dict_create_foreign_constraints_low(
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_alter
,
name
,
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_alter
,
name
,
&
success
,
heap
,
&
referenced_table_name
);
&
success
,
heap
,
&
referenced_table_name
);
if
(
table_to_alter
)
{
{
char
*
bufend
;
const
char
*
n
=
table_to_alter
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
?
table_to_alter
->
name
:
referenced_table_name
;
table_to_alter
->
name
,
strlen
(
table_to_alter
->
name
),
char
*
bufend
=
innobase_convert_name
(
trx
->
mysql_thd
,
TRUE
);
create_name
,
MAX_TABLE_NAME_LEN
,
n
,
strlen
(
n
),
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
else
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
referenced_table_name
,
strlen
(
referenced_table_name
),
trx
->
mysql_thd
,
TRUE
);
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
}
if
(
!
success
)
{
if
(
!
success
)
{
...
...
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