1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä
2022-08-30 12:17:33 +03:00
12 changed files with 290 additions and 39 deletions

View File

@ -3038,6 +3038,122 @@ a
3 3
2 2
drop table t1,t2,t3; drop table t1,t2,t3;
#
# MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of
# IN/ALL/ANY/EXISTS subquery
#
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create table t4 (d int);
insert into t1 values (3), (1);
insert into t2 values (3), (2);
insert into t3 values (4), (2);
insert into t4 values (1), (7);
explain extended select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
b
3
2
prepare stmt from "select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) in (select d from t4))";
execute stmt;
b
3
2
execute stmt;
b
3
2
deallocate prepare stmt;
explain extended select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) >=
any (select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) >=
any (select d from t4));
b
3
2
explain extended select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) <
all (select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) <
all (select d from t4));
b
3
2
explain extended select b from t2
where b in (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` semi join (`test`.`t3`) where 1
select b from t2
where b in (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
b
2
explain extended select b from t2
where b >= any (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <nop>(<in_optimizer>(`test`.`t2`.`b`,(/* select#2 */ select min(`test`.`t3`.`c`) from `test`.`t3`) <= <cache>(`test`.`t2`.`b`)))
select b from t2
where b >= any (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
b
3
2
explain extended select b from t2
where b <= all (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <not>(<in_optimizer>(`test`.`t2`.`b`,<min>(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3`) < <cache>(`test`.`t2`.`b`)))
select b from t2
where b <= all (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
b
2
drop table t1,t2,t3,t4;
# End of 10.3 tests # End of 10.3 tests
# #
# MDEV-19134: EXISTS() slower if ORDER BY is defined # MDEV-19134: EXISTS() slower if ORDER BY is defined

View File

@ -2477,6 +2477,80 @@ eval $q3;
drop table t1,t2,t3; drop table t1,t2,t3;
--echo #
--echo # MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of
--echo # IN/ALL/ANY/EXISTS subquery
--echo #
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create table t4 (d int);
insert into t1 values (3), (1);
insert into t2 values (3), (2);
insert into t3 values (4), (2);
insert into t4 values (1), (7);
let $q1=
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
eval explain extended $q1;
eval $q1;
eval prepare stmt from "$q1";
execute stmt;
execute stmt;
deallocate prepare stmt;
let $q2=
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) >=
any (select d from t4));
eval explain extended $q2;
eval $q2;
let $q3=
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) <
all (select d from t4));
eval explain extended $q3;
eval $q3;
let $q4=
select b from t2
where b in (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
eval explain extended $q4;
eval $q4;
let $q5=
select b from t2
where b >= any (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
eval explain extended $q5;
eval $q5;
let $q6=
select b from t2
where b <= all (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
eval explain extended $q6;
eval $q6;
drop table t1,t2,t3,t4;
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #

View File

@ -11,6 +11,21 @@ CREATE TABLE `d255`.`_##################################################`
ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/_@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023 ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/_@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023
CREATE TABLE `d255`.`##################################################` CREATE TABLE `d255`.`##################################################`
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; (a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;
#
# MDEV-29258 Failing assertion for name length on RENAME TABLE
#
CREATE TABLE `d255`.`d245` (x INT) ENGINE=InnoDB;
DROP TABLE `d255`.`d250`;
RENAME TABLE `d250#`.`d245` TO `d250#`.`d250`;
RENAME TABLE `d255`.`d250` TO a;
DROP TABLE a,t;
#
# MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE
#
CREATE TABLE `d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB;
CREATE TABLE `d255`.u(a INT PRIMARY KEY,
CONSTRAINT `d320` FOREIGN KEY (a) REFERENCES `d255`.t (a)) ENGINE=InnoDB;
RENAME TABLE `d255`.u TO u;
DROP TABLE u;
DROP DATABASE `d255`; DROP DATABASE `d255`;
DROP TABLE t;
# End of 10.3 tests # End of 10.3 tests

View File

@ -38,8 +38,40 @@ eval CREATE TABLE `$d255`.`_$d250`
--replace_result $d255 d255 --replace_result $d255 d255
eval CREATE TABLE `$d255`.`$d250` eval CREATE TABLE `$d255`.`$d250`
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; (a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;
--echo #
--echo # MDEV-29258 Failing assertion for name length on RENAME TABLE
--echo #
let $d245=-------------------------------------------------;
--replace_result $d245 d245 $d255 d255
eval CREATE TABLE `$d255`.`$d245` (x INT) ENGINE=InnoDB;
--replace_result $d250 d250 $d255 d255
eval DROP TABLE `$d255`.`$d250`;
--replace_result $d245 d245 $d250 d250 d255 d255
eval RENAME TABLE `$d255`.`$d245` TO `$d255`.`$d250`;
--replace_result $d250 d250 $d255 d255
eval RENAME TABLE `$d255`.`$d250` TO a;
--replace_result $d255 d255
DROP TABLE a,t;
--echo #
--echo # MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE
--echo #
let $d225=#############################################;
let $d320=################################################################;
--replace_result $d255 d255
eval CREATE TABLE `$d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB;
--replace_result $d255 d255 $d320 d320
eval CREATE TABLE `$d255`.u(a INT PRIMARY KEY,
CONSTRAINT `$d320` FOREIGN KEY (a) REFERENCES `$d255`.t (a)) ENGINE=InnoDB;
--replace_result $d255 d255
eval RENAME TABLE `$d255`.u TO u;
DROP TABLE u;
--replace_result $d255 d255 --replace_result $d255 d255
eval DROP DATABASE `$d255`; eval DROP DATABASE `$d255`;
DROP TABLE t;
--echo # End of 10.3 tests --echo # End of 10.3 tests

View File

@ -78,10 +78,10 @@ let $counter= 80;
let $mysql_errno= 0; let $mysql_errno= 0;
while (!$mysql_errno) while (!$mysql_errno)
{ {
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013 --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014
show status; show status;
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013 --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014
select * from information_schema.innodb_sys_semaphore_waits; select * from information_schema.innodb_sys_semaphore_waits;
dec $counter; dec $counter;

View File

@ -1,4 +1,5 @@
INSTALL PLUGIN simple_parser SONAME 'mypluglib'; INSTALL PLUGIN simple_parser SONAME 'mypluglib';
FLUSH TABLES;
# Test Part 1: Grammar Test # Test Part 1: Grammar Test
CREATE TABLE articles ( CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
@ -31,7 +32,7 @@ INSERT INTO articles (title, body) VALUES
('1001 MySQL Tricks','How to use full-text search engine'), ('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine'); ('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql'); MATCH(title, body) AGAINST('mysql') ORDER BY id;
id title body id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ... 1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ... 2 How To Use MySQL Well After you went through a ...
@ -68,7 +69,7 @@ INSERT INTO articles (title, body) VALUES
('Go MySQL Tricks','How to use full text search engine'); ('Go MySQL Tricks','How to use full text search engine');
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql'); MATCH(title, body) AGAINST('mysql') ORDER BY id;
id title body id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ... 1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ... 2 How To Use MySQL Well After you went through a ...
@ -88,21 +89,23 @@ MATCH(title, body) AGAINST('full text');
id title body id title body
5 Go MySQL Tricks How to use full text search engine 5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION); MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION)
ORDER BY id;
id title body id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine 4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine 5 Go MySQL Tricks How to use full text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION)
ORDER BY id;
id title body id title body
5 Go MySQL Tricks How to use full text search engine
4 1001 MySQL Tricks How to use full-text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ... 1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ... 3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
id title body id title body
@ -137,27 +140,27 @@ INSERT INTO articles (title, body) VALUES
('Go MariaDB Tricks','How to use full text search engine'); ('Go MariaDB Tricks','How to use full text search engine');
# restart # restart
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('MySQL'); MATCH(title, body) AGAINST('MySQL') ORDER BY id;
id title body id title body
6 MySQL Tutorial DBMS stands for MySQL DataBase ... 6 MySQL Tutorial DBMS stands for MySQL DataBase ...
7 How To Use MySQL Well After you went through a ... 7 How To Use MySQL Well After you went through a ...
8 Optimizing MySQL In this tutorial we will show ... 8 Optimizing MySQL In this tutorial we will show ...
9 1001 MySQL Tricks How to use full-text search engine 9 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('tutorial'); MATCH(title, body) AGAINST('tutorial') ORDER BY id;
id title body id title body
6 MySQL Tutorial DBMS stands for MySQL DataBase ... 6 MySQL Tutorial DBMS stands for MySQL DataBase ...
8 Optimizing MySQL In this tutorial we will show ... 8 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks'); MATCH(title, body) AGAINST('Tricks') ORDER BY id;
id title body id title body
9 1001 MySQL Tricks How to use full-text search engine 9 1001 MySQL Tricks How to use full-text search engine
10 Go MariaDB Tricks How to use full text search engine 10 Go MariaDB Tricks How to use full text search engine
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text search'); MATCH(title, body) AGAINST('full text search') ORDER BY id;
id title body id title body
10 Go MariaDB Tricks How to use full text search engine
9 1001 MySQL Tricks How to use full-text search engine 9 1001 MySQL Tricks How to use full-text search engine
10 Go MariaDB Tricks How to use full text search engine
SELECT COUNT(*) FROM articles; SELECT COUNT(*) FROM articles;
COUNT(*) COUNT(*)
5 5
@ -185,7 +188,8 @@ UNINSTALL PLUGIN simple_parser;
Warnings: Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown Warning 1620 Plugin is busy and will be uninstalled on shutdown
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql'); MATCH(title, body) AGAINST('mysql')
ORDER BY id;
id title body id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ... 1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ... 2 How To Use MySQL Well After you went through a ...

View File

@ -6,6 +6,9 @@
# Install fts parser plugin # Install fts parser plugin
INSTALL PLUGIN simple_parser SONAME 'mypluglib'; INSTALL PLUGIN simple_parser SONAME 'mypluglib';
# Flush the table mysql.plugin in case the server shutdown would time out.
FLUSH TABLES;
-- echo # Test Part 1: Grammar Test -- echo # Test Part 1: Grammar Test
# Create a myisam table and alter it to innodb table # Create a myisam table and alter it to innodb table
CREATE TABLE articles ( CREATE TABLE articles (
@ -52,7 +55,7 @@ INSERT INTO articles (title, body) VALUES
# Simple term search # Simple term search
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql'); MATCH(title, body) AGAINST('mysql') ORDER BY id;
# Test stopword and word len less than fts_min_token_size # Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
@ -90,7 +93,7 @@ ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
# Simple term search # Simple term search
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql'); MATCH(title, body) AGAINST('mysql') ORDER BY id;
# Test stopword and word len less than fts_min_token_size # Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
@ -105,10 +108,12 @@ SELECT * FROM articles WHERE
# Test query expansion # Test query expansion
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION); MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION)
ORDER BY id;
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION)
ORDER BY id;
# No result here, we get '"mysql' 'database"' by simple parser # No result here, we get '"mysql' 'database"' by simple parser
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
@ -150,13 +155,13 @@ INSERT INTO articles (title, body) VALUES
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('MySQL'); MATCH(title, body) AGAINST('MySQL') ORDER BY id;
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('tutorial'); MATCH(title, body) AGAINST('tutorial') ORDER BY id;
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks'); MATCH(title, body) AGAINST('Tricks') ORDER BY id;
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text search'); MATCH(title, body) AGAINST('full text search') ORDER BY id;
SELECT COUNT(*) FROM articles; SELECT COUNT(*) FROM articles;
INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234'); INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234');
@ -193,7 +198,8 @@ UNINSTALL PLUGIN simple_parser;
# Simple term search # Simple term search
SELECT * FROM articles WHERE SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql'); MATCH(title, body) AGAINST('mysql')
ORDER BY id;
# Test stopword and word len less than fts_min_token_size # Test stopword and word len less than fts_min_token_size
SELECT * FROM articles WHERE SELECT * FROM articles WHERE

View File

@ -386,7 +386,8 @@ bool Item_subselect::mark_as_eliminated_processor(void *arg)
bool Item_subselect::eliminate_subselect_processor(void *arg) bool Item_subselect::eliminate_subselect_processor(void *arg)
{ {
unit->item= NULL; unit->item= NULL;
unit->exclude(); if (!unit->is_excluded())
unit->exclude();
eliminated= TRUE; eliminated= TRUE;
return FALSE; return FALSE;
} }

View File

@ -4659,7 +4659,8 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
int int
rename_file_ext(const char * from,const char * to,const char * ext) rename_file_ext(const char * from,const char * to,const char * ext)
{ {
char from_b[FN_REFLEN],to_b[FN_REFLEN]; /* Reserve space for ./databasename/tablename.frm + NUL byte */
char from_b[2 + FN_REFLEN + 4 + 1], to_b[2 + FN_REFLEN + 4 + 1];
(void) strxmov(from_b,from,ext,NullS); (void) strxmov(from_b,from,ext,NullS);
(void) strxmov(to_b,to,ext,NullS); (void) strxmov(to_b,to,ext,NullS);
return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0)); return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0));

View File

@ -1469,7 +1469,7 @@ dict_table_rename_in_cache(
in UTF-8 charset. The variable fkid here is used in UTF-8 charset. The variable fkid here is used
to store foreign key constraint name in charset to store foreign key constraint name in charset
my_charset_filename for comparison further below. */ my_charset_filename for comparison further below. */
char fkid[MAX_TABLE_NAME_LEN+20]; char fkid[MAX_TABLE_NAME_LEN * 2 + 20];
ibool on_tmp = FALSE; ibool on_tmp = FALSE;
/* The old table name in my_charset_filename is stored /* The old table name in my_charset_filename is stored
@ -1503,7 +1503,8 @@ dict_table_rename_in_cache(
} }
} }
strncpy(fkid, foreign->id, MAX_TABLE_NAME_LEN); strncpy(fkid, foreign->id, (sizeof fkid) - 1);
fkid[(sizeof fkid) - 1] = '\0';
if (strstr(fkid, TEMP_TABLE_PATH_PREFIX) == NULL) { if (strstr(fkid, TEMP_TABLE_PATH_PREFIX) == NULL) {
innobase_convert_to_filename_charset( innobase_convert_to_filename_charset(
@ -3489,10 +3490,11 @@ dict_table_get_highest_foreign_id(
for (dict_foreign_set::iterator it = table->foreign_set.begin(); for (dict_foreign_set::iterator it = table->foreign_set.begin();
it != table->foreign_set.end(); it != table->foreign_set.end();
++it) { ++it) {
char fkid[MAX_TABLE_NAME_LEN+20]; char fkid[MAX_TABLE_NAME_LEN * 2 + 20];
foreign = *it; foreign = *it;
strcpy(fkid, foreign->id); strncpy(fkid, foreign->id, (sizeof fkid) - 1);
fkid[(sizeof fkid) - 1] = '\0';
/* Convert foreign key identifier on dictionary memory /* Convert foreign key identifier on dictionary memory
cache to filename charset. */ cache to filename charset. */
innobase_convert_to_filename_charset( innobase_convert_to_filename_charset(

View File

@ -2002,7 +2002,7 @@ fil_op_write_log(
case MLOG_FILE_RENAME2: case MLOG_FILE_RENAME2:
ut_ad(strchr(new_path, OS_PATH_SEPARATOR) != NULL); ut_ad(strchr(new_path, OS_PATH_SEPARATOR) != NULL);
len = strlen(new_path) + 1; len = strlen(new_path) + 1;
log_ptr = mlog_open(mtr, 2 + len); log_ptr = mlog_open(mtr, 2);
ut_a(log_ptr); ut_a(log_ptr);
mach_write_to_2(log_ptr, len); mach_write_to_2(log_ptr, len);
log_ptr += 2; log_ptr += 2;

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2021, MariaDB Corporation. Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -1977,9 +1977,9 @@ trx_undo_page_report_rename(trx_t* trx, const dict_table_t* table,
byte* start = block->frame + first_free; byte* start = block->frame + first_free;
size_t len = strlen(table->name.m_name); size_t len = strlen(table->name.m_name);
const size_t fixed = 2 + 1 + 11 + 11 + 2; const size_t fixed = 2 + 1 + 11 + 11 + 2;
ut_ad(len <= NAME_LEN * 2 + 1); ut_ad(len <= NAME_CHAR_LEN * 5 * 2 + 1);
/* The -10 is used in trx_undo_left() */ /* The -10 is used in trx_undo_left() */
compile_time_assert((NAME_LEN * 1) * 2 + fixed compile_time_assert(NAME_CHAR_LEN * 5 * 2 + fixed
+ TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE
< UNIV_PAGE_SIZE_MIN - 10 - FIL_PAGE_DATA_END); < UNIV_PAGE_SIZE_MIN - 10 - FIL_PAGE_DATA_END);