diff options
author | Monty <monty@mariadb.org> | 2020-04-09 16:52:59 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-04-19 17:33:51 +0300 |
commit | f40ca33bbc605af28492b58dde35bf2a97126b5f (patch) | |
tree | 43b4b60902d9cbd97cddc4b519e24decc5643d27 | |
parent | eca5c2c67ff1854b186b0e1b8dd342cb988e94d2 (diff) | |
download | mariadb-git-f40ca33bbc605af28492b58dde35bf2a97126b5f.tar.gz |
Make all #sql temporary table names uniform
The reason for this is to make all temporary file names similar and
also to be able to figure out from where a #sql-xxx name orginates.
New format is for most cases:
'#sql-name-current_pid-thread_id[-increment]'
Where name is one of subselect, alter, exchange, temptable or backup
The exceptions are:
ALTER PARTITION shadow files:
'#sql-shadow-thread_id-'original_table_name'
Names used with temp pool:
'#sql-name-current_pid-pool_number'
-rw-r--r-- | mysql-test/suite/innodb/r/alter_copy.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/innodb_bug12902967.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/alter_copy.test | 6 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb_bug12902967.test | 2 | ||||
-rw-r--r-- | mysql-test/suite/parts/inc/partition_crash.inc | 2 | ||||
-rw-r--r-- | mysql-test/suite/parts/inc/partition_fail_t2.inc | 2 | ||||
-rw-r--r-- | mysql-test/suite/parts/r/partition_debug.result | 12 | ||||
-rw-r--r-- | mysql-test/suite/parts/r/partition_debug_innodb.result | 88 | ||||
-rw-r--r-- | mysql-test/suite/parts/r/partition_debug_myisam.result | 76 | ||||
-rw-r--r-- | sql/opt_subselect.cc | 4 | ||||
-rw-r--r-- | sql/sql_alter.cc | 3 | ||||
-rw-r--r-- | sql/sql_partition_admin.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 6 | ||||
-rw-r--r-- | sql/sql_table.cc | 10 | ||||
-rw-r--r-- | storage/innobase/row/row0mysql.cc | 13 | ||||
-rw-r--r-- | storage/maria/ha_s3.cc | 19 |
16 files changed, 140 insertions, 119 deletions
diff --git a/mysql-test/suite/innodb/r/alter_copy.result b/mysql-test/suite/innodb/r/alter_copy.result index 4aece16f0b0..9b8f04eacca 100644 --- a/mysql-test/suite/innodb/r/alter_copy.result +++ b/mysql-test/suite/innodb/r/alter_copy.result @@ -53,8 +53,8 @@ connection default; SET DEBUG_SYNC='now WAIT_FOR hung'; # restart: --innodb-force-recovery=3 disconnect hang; -#sql-temporary.frm -#sql-temporary.ibd +#sql-alter.frm +#sql-alter.ibd FTS_INDEX_1.ibd FTS_INDEX_2.ibd FTS_INDEX_3.ibd @@ -122,8 +122,8 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK # restart: --innodb-read-only -#sql-temporary.frm -#sql-temporary.ibd +#sql-alter.frm +#sql-alter.ibd FTS_INDEX_1.ibd FTS_INDEX_2.ibd FTS_INDEX_3.ibd @@ -191,7 +191,7 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK # restart -#sql-temporary.frm +#sql-alter.frm FTS_INDEX_1.ibd FTS_INDEX_2.ibd FTS_INDEX_3.ibd diff --git a/mysql-test/suite/innodb/r/innodb_bug12902967.result b/mysql-test/suite/innodb/r/innodb_bug12902967.result index 6478cdb6c1f..ddb2e12f26a 100644 --- a/mysql-test/suite/innodb/r/innodb_bug12902967.result +++ b/mysql-test/suite/innodb/r/innodb_bug12902967.result @@ -2,5 +2,5 @@ call mtr.add_suppression("In ALTER TABLE .* has or is referenced in foreign key # restart create table t1 (f1 integer primary key) engine innodb; alter table t1 add constraint c1 foreign key (f1) references t1(f1); -ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150 "Foreign key constraint is incorrectly formed") +ERROR HY000: Error on rename of '#sql-alter' to './test/t1' (errno: 150 "Foreign key constraint is incorrectly formed") drop table t1; diff --git a/mysql-test/suite/innodb/t/alter_copy.test b/mysql-test/suite/innodb/t/alter_copy.test index e85b94d467f..de2f99b68d4 100644 --- a/mysql-test/suite/innodb/t/alter_copy.test +++ b/mysql-test/suite/innodb/t/alter_copy.test @@ -63,7 +63,7 @@ let $shutdown_timeout=0; disconnect hang; let $shutdown_timeout=; let $datadir=`select @@datadir`; ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/ +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/ --list_files $datadir/test SHOW CREATE TABLE t; SELECT COUNT(*) FROM t; @@ -76,7 +76,7 @@ CHECK TABLE t1; --let $restart_parameters= --innodb-read-only --source include/restart_mysqld.inc ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/ +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/ --list_files $datadir/test SHOW CREATE TABLE t; @@ -90,7 +90,7 @@ CHECK TABLE t1; --let $restart_parameters= --source include/restart_mysqld.inc ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/ +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/ --list_files $datadir/test DROP TABLE t1,t; diff --git a/mysql-test/suite/innodb/t/innodb_bug12902967.test b/mysql-test/suite/innodb/t/innodb_bug12902967.test index 1b5df7fa165..5bd32cdf627 100644 --- a/mysql-test/suite/innodb/t/innodb_bug12902967.test +++ b/mysql-test/suite/innodb/t/innodb_bug12902967.test @@ -19,7 +19,7 @@ create table t1 (f1 integer primary key) engine innodb; # The below statement should produce error message in error log. # This error message should mention problem with foreign keys # rather than with data dictionary. ---replace_regex /'\.\/test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ +--replace_regex /'\.\/test\/#sql-alter-[0-9a-f_\-]*'/'#sql-alter'/ --error ER_ERROR_ON_RENAME alter table t1 add constraint c1 foreign key (f1) references t1(f1); drop table t1; diff --git a/mysql-test/suite/parts/inc/partition_crash.inc b/mysql-test/suite/parts/inc/partition_crash.inc index 98229544621..2ab60a2581f 100644 --- a/mysql-test/suite/parts/inc/partition_crash.inc +++ b/mysql-test/suite/parts/inc/partition_crash.inc @@ -20,7 +20,7 @@ SELECT * FROM t1; --echo # State after crash (before recovery) --list_files_write_file $DATADIR.files.txt $DATADIR/test --replace_result #p# #P# #sp# #SP# #tmp# #TMP# ---replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#sql-ib[1-9][0-9]*\.ibd\n// +--replace_regex /sql-exchange.*\./sql-exchange./ /sql-shadow-[0-9a-f]*-/sql-shadow-/ --cat_file $DATADIR.files.txt --remove_file $DATADIR.files.txt --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect diff --git a/mysql-test/suite/parts/inc/partition_fail_t2.inc b/mysql-test/suite/parts/inc/partition_fail_t2.inc index 12cac51db4d..492e6d5a71b 100644 --- a/mysql-test/suite/parts/inc/partition_fail_t2.inc +++ b/mysql-test/suite/parts/inc/partition_fail_t2.inc @@ -15,7 +15,7 @@ SHOW CREATE TABLE t1; SELECT * FROM t1; # accept all errors --disable_abort_on_error ---replace_regex /#sqlx-[0-9a-f_]*/#sqlx-nnnn_nnnn/i +--replace_regex /#sql-exchange-[0-9a-f_\-]*/#sql-exchange/i --eval $fail_statement --enable_abort_on_error --echo # State after failure diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result index 9ede9d39504..130a23da7e6 100644 --- a/mysql-test/suite/parts/r/partition_debug.result +++ b/mysql-test/suite/parts/r/partition_debug.result @@ -422,7 +422,7 @@ a b ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sqlx-nnnn_nnnn.frm +#sql-exchange.frm # State after crash recovery db.opt t1#P#p0.MYD @@ -528,7 +528,7 @@ a b ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sqlx-nnnn_nnnn.frm +#sql-exchange.frm # State after crash recovery db.opt t1#P#p0.MYD @@ -634,7 +634,7 @@ a b ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sqlx-nnnn_nnnn.frm +#sql-exchange.frm # State after crash recovery db.opt t1#P#p0.MYD @@ -740,7 +740,7 @@ a b ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sqlx-nnnn_nnnn.frm +#sql-exchange.frm # State after crash recovery db.opt t1#P#p0.MYD @@ -1283,7 +1283,7 @@ a b 3 Original from partition p0 4 Original from partition p0 ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; -ERROR HY000: Error on rename of './test/t2' to './test/#sqlx-nnnn_nnnn' (errno: 0 "Internal error/check (Not system error)") +ERROR HY000: Error on rename of './test/t2' to './test/#sql-exchange' (errno: 0 "Internal error/check (Not system error)") # State after failure db.opt t1#P#p0.MYD @@ -1699,7 +1699,7 @@ a b 3 Original from partition p0 4 Original from partition p0 ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; -ERROR HY000: Error on rename of './test/#sqlx-nnnn_nnnn' to './test/t1#P#p0' (errno: 0 "Internal error/check (Not system error)") +ERROR HY000: Error on rename of './test/#sql-exchange' to './test/t1#P#p0' (errno: 0 "Internal error/check (Not system error)") # State after failure db.opt t1#P#p0.MYD diff --git a/mysql-test/suite/parts/r/partition_debug_innodb.result b/mysql-test/suite/parts/r/partition_debug_innodb.result index 0a7efba416a..ffca0acdb16 100644 --- a/mysql-test/suite/parts/r/partition_debug_innodb.result +++ b/mysql-test/suite/parts/r/partition_debug_innodb.result @@ -116,8 +116,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -186,8 +186,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -256,8 +256,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -326,8 +326,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -397,8 +397,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -468,8 +468,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -539,8 +539,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -2086,8 +2086,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -2155,8 +2155,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -2224,8 +2224,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -2287,8 +2287,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -2350,8 +2350,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -3705,8 +3705,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -3776,8 +3776,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10.ibd @@ -3847,8 +3847,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10#TMP#.ibd @@ -3920,8 +3920,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10#TMP#.ibd @@ -3993,8 +3993,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10#TMP#.ibd @@ -4066,8 +4066,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10#TMP#.ibd @@ -4141,8 +4141,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.ibd t1#P#p10#TMP#.ibd @@ -6406,7 +6406,7 @@ a b ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sqlx-nnnn_nnnn.frm +#sql-exchange.frm # State after crash recovery db.opt t1#P#p0.ibd @@ -6508,7 +6508,7 @@ a b ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sqlx-nnnn_nnnn.frm +#sql-exchange.frm # State after crash recovery db.opt t1#P#p0.ibd @@ -6610,7 +6610,7 @@ a b ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sqlx-nnnn_nnnn.ibd +#sql-exchange.ibd # State after crash recovery db.opt t1#P#p0.ibd @@ -6712,7 +6712,7 @@ a b ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sqlx-nnnn_nnnn.ibd +#sql-exchange.ibd # State after crash recovery db.opt t1#P#p0.ibd @@ -7229,7 +7229,7 @@ a b 3 Original from partition p0 4 Original from partition p0 ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; -ERROR HY000: Error on rename of './test/t2' to './test/#sqlx-nnnn_nnnn' (errno: 0 "Internal error/check (Not system error)") +ERROR HY000: Error on rename of './test/t2' to './test/#sql-exchange' (errno: 0 "Internal error/check (Not system error)") # State after failure db.opt t1#P#p0.ibd @@ -7629,7 +7629,7 @@ a b 3 Original from partition p0 4 Original from partition p0 ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; -ERROR HY000: Error on rename of './test/#sqlx-nnnn_nnnn' to './test/t1#P#p0' (errno: 0 "Internal error/check (Not system error)") +ERROR HY000: Error on rename of './test/#sql-exchange' to './test/t1#P#p0' (errno: 0 "Internal error/check (Not system error)") # State after failure db.opt t1#P#p0.ibd diff --git a/mysql-test/suite/parts/r/partition_debug_myisam.result b/mysql-test/suite/parts/r/partition_debug_myisam.result index 0b1004d121d..ffbc4ff6694 100644 --- a/mysql-test/suite/parts/r/partition_debug_myisam.result +++ b/mysql-test/suite/parts/r/partition_debug_myisam.result @@ -121,8 +121,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -197,8 +197,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -273,8 +273,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -349,8 +349,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -427,8 +427,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -505,8 +505,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -583,8 +583,8 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -2246,8 +2246,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -2321,8 +2321,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -2396,8 +2396,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -2464,8 +2464,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -2532,8 +2532,8 @@ a b ALTER TABLE t1 DROP PARTITION p10; ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -3971,8 +3971,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -4048,8 +4048,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -4125,8 +4125,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -4206,8 +4206,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -4287,8 +4287,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -4368,8 +4368,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI @@ -4452,8 +4452,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par +#sql-shadow-t1.frm +#sql-shadow-t1.par db.opt t1#P#p0.MYD t1#P#p0.MYI diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 38779619b82..1e0a5398f6a 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -4459,12 +4459,12 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd) temp_pool_slot = bitmap_lock_set_next(&temp_pool); if (temp_pool_slot != MY_BIT_NONE) // we got a slot - sprintf(path, "%s_%lx_%i", tmp_file_prefix, + sprintf(path, "%s-subquery-%lx-%i", tmp_file_prefix, current_pid, temp_pool_slot); else { /* if we run out of slots or we are not using tempool */ - sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid, + sprintf(path,"%s-subquery-%lx-%lx-%x", tmp_file_prefix,current_pid, (ulong) thd->thread_id, thd->tmp_table++); } fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME); diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 131f74c2753..2cbbd83ec36 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -322,7 +322,8 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list, } tmp_name.str= tmp_name_buff; - tmp_name.length= my_snprintf(tmp_name_buff, sizeof(tmp_name_buff), "%s-%lx_%llx", + tmp_name.length= my_snprintf(tmp_name_buff, sizeof(tmp_name_buff), + "%s-alter-%lx-%llx", tmp_file_prefix, current_pid, thd->thread_id); /* Safety fix for InnoDB */ if (lower_case_table_names) diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index 13547a0a8be..7822cab5ff0 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -600,8 +600,8 @@ bool Sql_cmd_alter_table_exchange_partition:: swap_table_list->db.str, swap_table_list->table_name.str, "", 0); - /* create a unique temp name #sqlx-nnnn_nnnn, x for eXchange */ - my_snprintf(temp_name, sizeof(temp_name), "%sx-%lx_%llx", + /* create a unique temp name */ + my_snprintf(temp_name, sizeof(temp_name), "%s-exchange-%lx-%llx", tmp_file_prefix, current_pid, thd->thread_id); if (lower_case_table_names) my_casedn_str(files_charset_info, temp_name); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index da30fda40f7..638f044be77 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -18266,13 +18266,13 @@ TABLE *Create_tmp_table::start(THD *thd, m_temp_pool_slot = bitmap_lock_set_next(&temp_pool); if (m_temp_pool_slot != MY_BIT_NONE) // we got a slot - sprintf(path, "%s-%lx-%i", tmp_file_prefix, + sprintf(path, "%s-temptable-%lx-%i", tmp_file_prefix, current_pid, m_temp_pool_slot); else { /* if we run out of slots or we are not using tempool */ - sprintf(path, "%s-%lx-%lx-%x", tmp_file_prefix,current_pid, - (ulong) thd->thread_id, thd->tmp_table++); + sprintf(path, "%s-temptable-%lx-%llx-%x", tmp_file_prefix,current_pid, + thd->thread_id, thd->tmp_table++); } /* diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0e80ac1d4f1..474009c8a66 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -594,7 +594,7 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen) DBUG_ENTER("build_tmptable_filename"); char *p= strnmov(buff, mysql_tmpdir, bufflen); - my_snprintf(p, bufflen - (p - buff), "/%s%lx_%llx_%x", + my_snprintf(p, bufflen - (p - buff), "/%s-temptable-%lx-%llx-%x", tmp_file_prefix, current_pid, thd->thread_id, thd->tmp_table++); @@ -1762,8 +1762,8 @@ uint build_table_shadow_filename(char *buff, size_t bufflen, ALTER_PARTITION_PARAM_TYPE *lpt) { char tmp_name[FN_REFLEN]; - my_snprintf(tmp_name, sizeof (tmp_name), "%s-%s", tmp_file_prefix, - lpt->table_name.str); + my_snprintf(tmp_name, sizeof (tmp_name), "%s-shadow-%lx-%s", tmp_file_prefix, + (ulong) current_thd->thread_id, lpt->table_name.str); return build_table_filename(buff, bufflen, lpt->db.str, tmp_name, "", FN_IS_TMP); } @@ -10720,8 +10720,8 @@ do_continue:; if (!alter_ctx.is_table_renamed()) { backup_name.length= my_snprintf(backup_name_buff, sizeof(backup_name_buff), - "%s2-%lx-%lx", tmp_file_prefix, - current_pid, (long) thd->thread_id); + "%s-backup-%lx-%llx", tmp_file_prefix, + current_pid, thd->thread_id); if (lower_case_table_names) my_casedn_str(files_charset_info, backup_name_buff); if (mysql_rename_table(old_db_type, &alter_ctx.db, &alter_ctx.table_name, diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 17df8e2aa0e..6a493c856f6 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -2748,7 +2748,10 @@ row_mysql_drop_garbage_tables() table_name = mem_heap_strdupl( heap, reinterpret_cast<const char*>(field), len); - if (strstr(table_name, "/" TEMP_FILE_PREFIX "-")) { + if (strstr(table_name, "/" TEMP_FILE_PREFIX "-") && + !strstr(table_name, "/" TEMP_FILE_PREFIX "-backup-") && + !strstr(table_name, "/" TEMP_FILE_PREFIX "-exchange-")) + { btr_pcur_store_position(&pcur, &mtr); btr_pcur_commit_specify_mtr(&pcur, &mtr); @@ -3517,13 +3520,15 @@ row_drop_table_for_mysql( if (table->n_foreign_key_checks_running > 0) { defer: - /* Rename #sql2 to #sql-ib if table has open ref count + /* Rename #sql-backup to #sql-ib if table has open ref count while dropping the table. This scenario can happen when purge thread is waiting for dict_sys.mutex so that it could close the table. But drop table acquires - dict_sys.mutex. */ + dict_sys.mutex. + In the future this should use 'tmp_file_prefix'! + */ if (!is_temp_name - || strstr(table->name.m_name, "/#sql2")) { + || strstr(table->name.m_name, "/#sql-backup-")) { heap = mem_heap_create(FN_REFLEN); const char* tmp_name = dict_mem_create_temporary_tablename( diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index c86e2e4f816..dc267d31405 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -305,15 +305,30 @@ static my_bool s3_info_init(S3_INFO *s3_info, const char *path, } /* - Check if table is a temporary table that is stored in Aria + Check if table is a temporary table + + Returns 1 if table is a temporary table that should be stored in Aria + (to later be copied to S3 with a name change) */ static int is_mariadb_internal_tmp_table(const char *table_name) { int length; + const int p_length= sizeof(tmp_file_prefix); // prefix + '-' /* Temporary table from ALTER TABLE */ - if (!strncmp(table_name, "#sql-", 5)) + if (!strncmp(table_name, tmp_file_prefix "-" , p_length)) + { + /* + Internal temporary tables used by ALTER TABLE and ALTER PARTITION + should be stored in S3 + */ + if (!strncmp(table_name+p_length, "backup-", sizeof("backup-")-1) || + !strncmp(table_name+p_length, "exchange-", sizeof("exchange-")-1) || + !strncmp(table_name+p_length, "temptable-", sizeof("temptable-")-1)) + return 0; + /* Other temporary tables should be stored in Aria on local disk */ return 1; + } length= strlen(table_name); if (length > 5 && !strncmp(table_name + length - 5, "#TMP#", 5)) return 1; |