Skip to content

Commit 0707dac

Browse files
committed
Merge branch '10.6' into 10.11
2 parents 95782e5 + 2ccf6a2 commit 0707dac

22 files changed

+204
-46
lines changed

client/mysqldump.c

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,26 @@ static char *cover_definer_clause(const char *stmt_str,
18701870
return query_str;
18711871
}
18721872

1873+
1874+
static const char* build_path_for_table(char *to, const char *dir,
1875+
const char *table, const char *ext)
1876+
{
1877+
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
1878+
convert_dirname(tmp_path, path, NULL);
1879+
my_load_path(tmp_path, tmp_path, NULL);
1880+
if (check_if_legal_tablename(table))
1881+
strxnmov(filename, sizeof(filename) - 1, table, "@@@", NULL);
1882+
else
1883+
{
1884+
uint errors, len;
1885+
len= my_convert(filename, sizeof(filename) - 1, &my_charset_filename,
1886+
table, (uint32)strlen(table), charset_info, &errors);
1887+
filename[len]= 0;
1888+
}
1889+
return fn_format(to, filename, tmp_path, ext, MYF(MY_UNPACK_FILENAME));
1890+
}
1891+
1892+
18731893
/*
18741894
Open a new .sql file to dump the table or view into
18751895
@@ -1884,12 +1904,9 @@ static char *cover_definer_clause(const char *stmt_str,
18841904
*/
18851905
static FILE* open_sql_file_for_table(const char* table, int flags)
18861906
{
1887-
FILE* res;
1888-
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
1889-
convert_dirname(tmp_path,path,NullS);
1890-
res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
1891-
flags, MYF(MY_WME));
1892-
return res;
1907+
char filename[FN_REFLEN];
1908+
return my_fopen(build_path_for_table(filename, path, table, ".sql"),
1909+
flags, MYF(MY_WME));
18931910
}
18941911

18951912

@@ -4135,14 +4152,9 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
41354152

41364153
if (path)
41374154
{
4138-
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
4139-
/*
4140-
Convert the path to native os format
4141-
and resolve to the full filepath.
4142-
*/
4143-
convert_dirname(tmp_path,path,NullS);
4144-
my_load_path(tmp_path, tmp_path, NULL);
4145-
fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
4155+
char filename[FN_REFLEN];
4156+
4157+
build_path_for_table(filename, path, table, ".txt");
41464158

41474159
/* Must delete the file that 'INTO OUTFILE' will write to */
41484160
my_delete(filename, MYF(0));
@@ -4151,7 +4163,6 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
41514163
to_unix_path(filename);
41524164

41534165
/* now build the query string */
4154-
41554166
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ ");
41564167
dynstr_append_checked(&query_string, select_field_names.str);
41574168
dynstr_append_checked(&query_string, " INTO OUTFILE '");

client/mysqlimport.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,17 @@ static int write_to_table(char *filename, MYSQL *mysql)
339339
DBUG_ENTER("write_to_table");
340340
DBUG_PRINT("enter",("filename: %s",filename));
341341

342-
fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */
342+
fn_format(tablename, filename, "", "", MYF(MY_REPLACE_DIR | MY_REPLACE_EXT));
343+
if (strchr(tablename, '@'))
344+
{
345+
uint errors, len;
346+
CHARSET_INFO *cs=
347+
get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(0));
348+
len= my_convert(escaped_name, sizeof(escaped_name) - 1, cs, tablename,
349+
(uint32)strlen(tablename), &my_charset_filename, &errors);
350+
if (!errors)
351+
strmake(tablename, escaped_name, len);
352+
}
343353
if (!opt_local_file)
344354
strmov(hard_path,filename);
345355
else
@@ -489,7 +499,7 @@ static MYSQL *db_connect(char *host, char *database,
489499
if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME))
490500
default_charset= (char *)my_default_csname();
491501
my_set_console_cp(default_charset);
492-
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, my_default_csname());
502+
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
493503
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
494504
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
495505
"program_name", "mysqlimport");

mysql-test/main/cte_recursive.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5969,3 +5969,10 @@ b rank() over (order by c)
59695969
drop view v1;
59705970
drop table t1;
59715971
# End of 10.4 tests
5972+
#
5973+
# MDEV-32308: Server crash on cleanup of
5974+
# non-fully-constructed-due-to-an-error CTE
5975+
#
5976+
SELECT ( WITH RECURSIVE x AS ( WITH x AS ( SELECT 1 FROM t14 ) SELECT x ) , t14 AS ( SELECT 1 UNION SELECT 'x' FROM x ) SELECT x FROM x WHERE ( SELECT x FROM x ) ) ;
5977+
ERROR 42S22: Unknown column 'x' in 'SELECT'
5978+
# End of 10.6 tests

mysql-test/main/cte_recursive.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4056,3 +4056,12 @@ drop view v1;
40564056
drop table t1;
40574057

40584058
--echo # End of 10.4 tests
4059+
4060+
--echo #
4061+
--echo # MDEV-32308: Server crash on cleanup of
4062+
--echo # non-fully-constructed-due-to-an-error CTE
4063+
--echo #
4064+
--error ER_BAD_FIELD_ERROR
4065+
SELECT ( WITH RECURSIVE x AS ( WITH x AS ( SELECT 1 FROM t14 ) SELECT x ) , t14 AS ( SELECT 1 UNION SELECT 'x' FROM x ) SELECT x FROM x WHERE ( SELECT x FROM x ) ) ;
4066+
4067+
--echo # End of 10.6 tests

mysql-test/main/mysqldump.result

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6781,6 +6781,52 @@ drop view `v'1"2`;
67816781
drop table t1;
67826782
# End of 10.5 tests
67836783
#
6784+
# MDEV-37483 mariadb-dump -T doesn't convert table names
6785+
#
6786+
create database foo;
6787+
use foo;
6788+
create table `con_schöne_grüße` (a int) select 1 as a;
6789+
create table `con` (b int) select 2 as b;
6790+
create table `con/bar` (c int) select 3 as c;
6791+
create table `con@fame` (d int) select 4 as d;
6792+
drop database foo;
6793+
use test;
6794+
con@002fbar.sql
6795+
con@002fbar.txt
6796+
con@@@.sql
6797+
con@@@.txt
6798+
con@fame.sql
6799+
con@fame.txt
6800+
con_sch@1ine_gr@1o@1je.sql
6801+
con_sch@1ine_gr@1o@1je.txt
6802+
show tables;
6803+
Tables_in_test
6804+
con
6805+
con/bar
6806+
con@fame
6807+
con_schöne_grüße
6808+
test.con: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
6809+
test.con/bar: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
6810+
test.con_schöne_grüße: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
6811+
test.con@fame: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
6812+
select * from `con_schöne_grüße`;
6813+
a
6814+
1
6815+
select * from `con`;
6816+
b
6817+
2
6818+
select * from `con/bar`;
6819+
c
6820+
3
6821+
select * from `con@fame`;
6822+
d
6823+
4
6824+
drop table `con_schöne_grüße`;
6825+
drop table `con`;
6826+
drop table `con/bar`;
6827+
drop table `con@fame`;
6828+
# End of 10.6 tests
6829+
#
67846830
# MDEV-16733 mysqldump --tab and --xml options are conflicting
67856831
#
67866832
mariadb-dump: --xml can't be used with --tab.

mysql-test/main/mysqldump.test

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,6 +3040,42 @@ drop table t1;
30403040

30413041
--echo # End of 10.5 tests
30423042

3043+
--echo #
3044+
--echo # MDEV-37483 mariadb-dump -T doesn't convert table names
3045+
--echo #
3046+
create database foo;
3047+
use foo;
3048+
3049+
create table `con_schöne_grüße` (a int) select 1 as a;
3050+
create table `con` (b int) select 2 as b;
3051+
create table `con/bar` (c int) select 3 as c;
3052+
create table `con@fame` (d int) select 4 as d;
3053+
exec $MYSQL_DUMP foo --tab $MYSQLTEST_VARDIR/tmp;
3054+
drop database foo;
3055+
use test;
3056+
move_file $MYSQLTEST_VARDIR/tmp/con@0040fame.sql $MYSQLTEST_VARDIR/tmp/con@fame.sql;
3057+
move_file $MYSQLTEST_VARDIR/tmp/con@0040fame.txt $MYSQLTEST_VARDIR/tmp/con@fame.txt;
3058+
list_files $MYSQLTEST_VARDIR/tmp con*;
3059+
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@@@.sql;
3060+
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@002fbar.sql;
3061+
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.sql;
3062+
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@fame.sql;
3063+
show tables;
3064+
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@@@.txt;
3065+
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@002fbar.txt;
3066+
exec $MYSQL_IMPORT --default-character-set=utf8mb4 test $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.txt;
3067+
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@fame.txt;
3068+
select * from `con_schöne_grüße`;
3069+
select * from `con`;
3070+
select * from `con/bar`;
3071+
select * from `con@fame`;
3072+
drop table `con_schöne_grüße`;
3073+
drop table `con`;
3074+
drop table `con/bar`;
3075+
drop table `con@fame`;
3076+
3077+
--echo # End of 10.6 tests
3078+
30433079
--echo #
30443080
--echo # MDEV-16733 mysqldump --tab and --xml options are conflicting
30453081
--echo #

mysql-test/suite/galera/t/MDEV-26266.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#
1111

1212
--source include/galera_cluster.inc
13+
--source include/no_protocol.inc
1314
--source include/have_innodb.inc
1415
--source include/force_restart.inc
1516

mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ INSERT INTO t1 VALUES(1, 'sql'), (2, 'server'), (3, 'mariadb'),
44
(4, 'mariadb'), (5, 'test1'), (6, 'test2'), (7, 'test3'),
55
(8, 'test4'), (9, 'test5'), (10, 'test6'), (11, 'test7'),
66
(12, 'test8');
7+
call mtr.add_suppression("InnoDB: Cannot apply log to \\[page id: space=[1-9], page number=0\\] of corrupted file '.*mdev_37412\\.ibd'");
8+
SET GLOBAL innodb_log_checkpoint_now=ON;
9+
CREATE TABLE mdev_37412(id INT AUTO_INCREMENT, PRIMARY KEY(id))
10+
STATS_PERSISTENT=0 ENGINE=InnoDB;
11+
# Kill the server
12+
# restart: --debug_dbug=+d,recv_corrupt
13+
SELECT * FROM mdev_37412;
14+
id
15+
DROP TABLE mdev_37412;
716
SELECT COUNT(*) FROM t1;
817
COUNT(*)
918
12

mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,23 @@ INSERT INTO t1 VALUES(1, 'sql'), (2, 'server'), (3, 'mariadb'),
2121
(8, 'test4'), (9, 'test5'), (10, 'test6'), (11, 'test7'),
2222
(12, 'test8');
2323

24+
call mtr.add_suppression("InnoDB: Cannot apply log to \\[page id: space=[1-9], page number=0\\] of corrupted file '.*mdev_37412\\.ibd'");
25+
SET GLOBAL innodb_log_checkpoint_now=ON;
26+
--source ../include/no_checkpoint_start.inc
27+
CREATE TABLE mdev_37412(id INT AUTO_INCREMENT, PRIMARY KEY(id))
28+
STATS_PERSISTENT=0 ENGINE=InnoDB;
29+
--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1,mdev_37412;
30+
--source ../include/no_checkpoint_end.inc
31+
32+
--let $restart_parameters=--debug_dbug=+d,recv_corrupt
33+
--source include/start_mysqld.inc
34+
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
35+
let SEARCH_PATTERN= InnoDB: Cannot apply log to \\[page id: space=[1-9], page number=0\\] of corrupted file '.*mdev_37412\\.ibd';
36+
--let $restart_parameters=
2437
let $restart_noprint=2;
2538
--source include/restart_mysqld.inc
39+
SELECT * FROM mdev_37412;
40+
DROP TABLE mdev_37412;
2641

2742
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
2843
let MYSQLD_DATADIR=`select @@datadir`;

mysql-test/suite/maria/bulk_insert_crash.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
create table t1 (a int primary key, b int, c int, unique key(b), key(c)) engine=aria transactional=1;
22
insert into t1 values (1000,1000,1000);
33
insert into t1 select seq,seq+100, seq+200 from seq_1_to_10;
4+
select sum(a),sum(b),sum(c) from t1;
5+
sum(a) sum(b) sum(c)
6+
1055 2055 3055
47
SET GLOBAL debug_dbug="+d,crash_end_bulk_insert";
58
REPLACE into t1 select seq+20,seq+95, seq + 300 from seq_1_to_10;
69
ERROR HY000: Lost connection to server during query

0 commit comments

Comments
 (0)