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'
This commit is contained in:
Monty 2020-04-09 16:52:59 +03:00
parent eca5c2c67f
commit f40ca33bbc
16 changed files with 140 additions and 119 deletions

View File

@ -53,8 +53,8 @@ connection default;
SET DEBUG_SYNC='now WAIT_FOR hung'; SET DEBUG_SYNC='now WAIT_FOR hung';
# restart: --innodb-force-recovery=3 # restart: --innodb-force-recovery=3
disconnect hang; disconnect hang;
#sql-temporary.frm #sql-alter.frm
#sql-temporary.ibd #sql-alter.ibd
FTS_INDEX_1.ibd FTS_INDEX_1.ibd
FTS_INDEX_2.ibd FTS_INDEX_2.ibd
FTS_INDEX_3.ibd FTS_INDEX_3.ibd
@ -122,8 +122,8 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
# restart: --innodb-read-only # restart: --innodb-read-only
#sql-temporary.frm #sql-alter.frm
#sql-temporary.ibd #sql-alter.ibd
FTS_INDEX_1.ibd FTS_INDEX_1.ibd
FTS_INDEX_2.ibd FTS_INDEX_2.ibd
FTS_INDEX_3.ibd FTS_INDEX_3.ibd
@ -191,7 +191,7 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
# restart # restart
#sql-temporary.frm #sql-alter.frm
FTS_INDEX_1.ibd FTS_INDEX_1.ibd
FTS_INDEX_2.ibd FTS_INDEX_2.ibd
FTS_INDEX_3.ibd FTS_INDEX_3.ibd

View File

@ -2,5 +2,5 @@ call mtr.add_suppression("In ALTER TABLE .* has or is referenced in foreign key
# restart # restart
create table t1 (f1 integer primary key) engine innodb; create table t1 (f1 integer primary key) engine innodb;
alter table t1 add constraint c1 foreign key (f1) references t1(f1); 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; drop table t1;

View File

@ -63,7 +63,7 @@ let $shutdown_timeout=0;
disconnect hang; disconnect hang;
let $shutdown_timeout=; let $shutdown_timeout=;
let $datadir=`select @@datadir`; 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 --list_files $datadir/test
SHOW CREATE TABLE t; SHOW CREATE TABLE t;
SELECT COUNT(*) FROM t; SELECT COUNT(*) FROM t;
@ -76,7 +76,7 @@ CHECK TABLE t1;
--let $restart_parameters= --innodb-read-only --let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc --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 --list_files $datadir/test
SHOW CREATE TABLE t; SHOW CREATE TABLE t;
@ -90,7 +90,7 @@ CHECK TABLE t1;
--let $restart_parameters= --let $restart_parameters=
--source include/restart_mysqld.inc --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 --list_files $datadir/test
DROP TABLE t1,t; DROP TABLE t1,t;

View File

@ -19,7 +19,7 @@ create table t1 (f1 integer primary key) engine innodb;
# The below statement should produce error message in error log. # The below statement should produce error message in error log.
# This error message should mention problem with foreign keys # This error message should mention problem with foreign keys
# rather than with data dictionary. # 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 --error ER_ERROR_ON_RENAME
alter table t1 add constraint c1 foreign key (f1) references t1(f1); alter table t1 add constraint c1 foreign key (f1) references t1(f1);
drop table t1; drop table t1;

View File

@ -20,7 +20,7 @@ SELECT * FROM t1;
--echo # State after crash (before recovery) --echo # State after crash (before recovery)
--list_files_write_file $DATADIR.files.txt $DATADIR/test --list_files_write_file $DATADIR.files.txt $DATADIR/test
--replace_result #p# #P# #sp# #SP# #tmp# #TMP# --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 --cat_file $DATADIR.files.txt
--remove_file $DATADIR.files.txt --remove_file $DATADIR.files.txt
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

View File

@ -15,7 +15,7 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
# accept all errors # accept all errors
--disable_abort_on_error --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 --eval $fail_statement
--enable_abort_on_error --enable_abort_on_error
--echo # State after failure --echo # State after failure

View File

@ -422,7 +422,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sqlx-nnnn_nnnn.frm #sql-exchange.frm
# State after crash recovery # State after crash recovery
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
@ -528,7 +528,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sqlx-nnnn_nnnn.frm #sql-exchange.frm
# State after crash recovery # State after crash recovery
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
@ -634,7 +634,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sqlx-nnnn_nnnn.frm #sql-exchange.frm
# State after crash recovery # State after crash recovery
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
@ -740,7 +740,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sqlx-nnnn_nnnn.frm #sql-exchange.frm
# State after crash recovery # State after crash recovery
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
@ -1283,7 +1283,7 @@ a b
3 Original from partition p0 3 Original from partition p0
4 Original from partition p0 4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; 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 # State after failure
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
@ -1699,7 +1699,7 @@ a b
3 Original from partition p0 3 Original from partition p0
4 Original from partition p0 4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; 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 # State after failure
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD

View File

@ -116,8 +116,8 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.ibd t1#P#p10.ibd
@ -2086,8 +2086,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.ibd t1#P#p10.ibd
@ -2155,8 +2155,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.ibd t1#P#p10.ibd
@ -2224,8 +2224,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.ibd t1#P#p10.ibd
@ -2287,8 +2287,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.ibd t1#P#p10.ibd
@ -2350,8 +2350,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10.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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10#TMP#.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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10#TMP#.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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10#TMP#.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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10#TMP#.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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
t1#P#p10#TMP#.ibd t1#P#p10#TMP#.ibd
@ -6406,7 +6406,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sqlx-nnnn_nnnn.frm #sql-exchange.frm
# State after crash recovery # State after crash recovery
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
@ -6508,7 +6508,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sqlx-nnnn_nnnn.frm #sql-exchange.frm
# State after crash recovery # State after crash recovery
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
@ -6610,7 +6610,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sqlx-nnnn_nnnn.ibd #sql-exchange.ibd
# State after crash recovery # State after crash recovery
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
@ -6712,7 +6712,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sqlx-nnnn_nnnn.ibd #sql-exchange.ibd
# State after crash recovery # State after crash recovery
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
@ -7229,7 +7229,7 @@ a b
3 Original from partition p0 3 Original from partition p0
4 Original from partition p0 4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; 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 # State after failure
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd
@ -7629,7 +7629,7 @@ a b
3 Original from partition p0 3 Original from partition p0
4 Original from partition p0 4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; 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 # State after failure
db.opt db.opt
t1#P#p0.ibd t1#P#p0.ibd

View File

@ -121,8 +121,8 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); (PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI t1#P#p0.MYI
@ -2246,8 +2246,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI t1#P#p0.MYI
@ -2321,8 +2321,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI t1#P#p0.MYI
@ -2396,8 +2396,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI t1#P#p0.MYI
@ -2464,8 +2464,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI t1#P#p0.MYI
@ -2532,8 +2532,8 @@ a b
ALTER TABLE t1 DROP PARTITION p10; ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI 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)); PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery) # State after crash (before recovery)
#sql-t1.frm #sql-shadow-t1.frm
#sql-t1.par #sql-shadow-t1.par
db.opt db.opt
t1#P#p0.MYD t1#P#p0.MYD
t1#P#p0.MYI t1#P#p0.MYI

View File

@ -4459,12 +4459,12 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
temp_pool_slot = bitmap_lock_set_next(&temp_pool); temp_pool_slot = bitmap_lock_set_next(&temp_pool);
if (temp_pool_slot != MY_BIT_NONE) // we got a slot 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); current_pid, temp_pool_slot);
else else
{ {
/* if we run out of slots or we are not using tempool */ /* 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++); (ulong) thd->thread_id, thd->tmp_table++);
} }
fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME); fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);

View File

@ -322,7 +322,8 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list,
} }
tmp_name.str= tmp_name_buff; 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); tmp_file_prefix, current_pid, thd->thread_id);
/* Safety fix for InnoDB */ /* Safety fix for InnoDB */
if (lower_case_table_names) if (lower_case_table_names)

View File

@ -600,8 +600,8 @@ bool Sql_cmd_alter_table_exchange_partition::
swap_table_list->db.str, swap_table_list->db.str,
swap_table_list->table_name.str, swap_table_list->table_name.str,
"", 0); "", 0);
/* create a unique temp name #sqlx-nnnn_nnnn, x for eXchange */ /* create a unique temp name */
my_snprintf(temp_name, sizeof(temp_name), "%sx-%lx_%llx", my_snprintf(temp_name, sizeof(temp_name), "%s-exchange-%lx-%llx",
tmp_file_prefix, current_pid, thd->thread_id); tmp_file_prefix, current_pid, thd->thread_id);
if (lower_case_table_names) if (lower_case_table_names)
my_casedn_str(files_charset_info, temp_name); my_casedn_str(files_charset_info, temp_name);

View File

@ -18266,13 +18266,13 @@ TABLE *Create_tmp_table::start(THD *thd,
m_temp_pool_slot = bitmap_lock_set_next(&temp_pool); m_temp_pool_slot = bitmap_lock_set_next(&temp_pool);
if (m_temp_pool_slot != MY_BIT_NONE) // we got a slot 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); current_pid, m_temp_pool_slot);
else else
{ {
/* if we run out of slots or we are not using tempool */ /* 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-temptable-%lx-%llx-%x", tmp_file_prefix,current_pid,
(ulong) thd->thread_id, thd->tmp_table++); thd->thread_id, thd->tmp_table++);
} }
/* /*

View File

@ -594,7 +594,7 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen)
DBUG_ENTER("build_tmptable_filename"); DBUG_ENTER("build_tmptable_filename");
char *p= strnmov(buff, mysql_tmpdir, bufflen); 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, tmp_file_prefix, current_pid,
thd->thread_id, thd->tmp_table++); 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) ALTER_PARTITION_PARAM_TYPE *lpt)
{ {
char tmp_name[FN_REFLEN]; char tmp_name[FN_REFLEN];
my_snprintf(tmp_name, sizeof (tmp_name), "%s-%s", tmp_file_prefix, my_snprintf(tmp_name, sizeof (tmp_name), "%s-shadow-%lx-%s", tmp_file_prefix,
lpt->table_name.str); (ulong) current_thd->thread_id, lpt->table_name.str);
return build_table_filename(buff, bufflen, lpt->db.str, tmp_name, "", return build_table_filename(buff, bufflen, lpt->db.str, tmp_name, "",
FN_IS_TMP); FN_IS_TMP);
} }
@ -10720,8 +10720,8 @@ do_continue:;
if (!alter_ctx.is_table_renamed()) if (!alter_ctx.is_table_renamed())
{ {
backup_name.length= my_snprintf(backup_name_buff, sizeof(backup_name_buff), backup_name.length= my_snprintf(backup_name_buff, sizeof(backup_name_buff),
"%s2-%lx-%lx", tmp_file_prefix, "%s-backup-%lx-%llx", tmp_file_prefix,
current_pid, (long) thd->thread_id); current_pid, thd->thread_id);
if (lower_case_table_names) if (lower_case_table_names)
my_casedn_str(files_charset_info, backup_name_buff); my_casedn_str(files_charset_info, backup_name_buff);
if (mysql_rename_table(old_db_type, &alter_ctx.db, &alter_ctx.table_name, if (mysql_rename_table(old_db_type, &alter_ctx.db, &alter_ctx.table_name,

View File

@ -2748,7 +2748,10 @@ row_mysql_drop_garbage_tables()
table_name = mem_heap_strdupl( table_name = mem_heap_strdupl(
heap, heap,
reinterpret_cast<const char*>(field), len); 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_store_position(&pcur, &mtr);
btr_pcur_commit_specify_mtr(&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) { if (table->n_foreign_key_checks_running > 0) {
defer: 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 while dropping the table. This scenario can happen
when purge thread is waiting for dict_sys.mutex so when purge thread is waiting for dict_sys.mutex so
that it could close the table. But drop table acquires 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 if (!is_temp_name
|| strstr(table->name.m_name, "/#sql2")) { || strstr(table->name.m_name, "/#sql-backup-")) {
heap = mem_heap_create(FN_REFLEN); heap = mem_heap_create(FN_REFLEN);
const char* tmp_name const char* tmp_name
= dict_mem_create_temporary_tablename( = dict_mem_create_temporary_tablename(

View File

@ -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) static int is_mariadb_internal_tmp_table(const char *table_name)
{ {
int length; int length;
const int p_length= sizeof(tmp_file_prefix); // prefix + '-'
/* Temporary table from ALTER TABLE */ /* 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; return 1;
}
length= strlen(table_name); length= strlen(table_name);
if (length > 5 && !strncmp(table_name + length - 5, "#TMP#", 5)) if (length > 5 && !strncmp(table_name + length - 5, "#TMP#", 5))
return 1; return 1;