mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-20310: Make InnoDB crash tests Valgrind-friendly
Use DEBUG_SYNC to hang the execution at the interesting point, and then kill and restart the server externally. This will work also with Valgrind. DBUG_SUICIDE() causes Valgrind to hang, and it could also cause uninteresting reports about memory leaks. While we are at it, let us clean up innodb.innodb_bulk_create_index_debug so that it will actually test the desired functionality also in future versions (with instant ADD COLUMN and DROP COLUMN) and avoid some unnecessary restarts. We are adding two DEBUG_SYNC points for ALTER TABLE, because there were none that would be executed right before ha_commit_trans().
This commit is contained in:
@ -4,17 +4,8 @@
|
|||||||
|
|
||||||
# Not supported in embedded
|
# Not supported in embedded
|
||||||
-- source include/not_embedded.inc
|
-- source include/not_embedded.inc
|
||||||
|
|
||||||
# This test case needs to crash the server. Needs a debug server.
|
|
||||||
-- source include/have_debug.inc
|
-- source include/have_debug.inc
|
||||||
|
-- source include/have_debug_sync.inc
|
||||||
# Don't test this under valgrind, memory leaks will occur.
|
|
||||||
-- source include/not_valgrind.inc
|
|
||||||
|
|
||||||
# Avoid CrashReporter popup on Mac
|
|
||||||
-- source include/not_crashrep.inc
|
|
||||||
|
|
||||||
-- source include/have_innodb.inc
|
|
||||||
|
|
||||||
# Create Insert Procedure
|
# Create Insert Procedure
|
||||||
DELIMITER |;
|
DELIMITER |;
|
||||||
@ -62,21 +53,11 @@ CALL populate_t1();
|
|||||||
|
|
||||||
SELECT COUNT(*) FROM t1;
|
SELECT COUNT(*) FROM t1;
|
||||||
|
|
||||||
|
--enable_info
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
|
--disable_info
|
||||||
|
|
||||||
--source include/restart_mysqld.inc
|
RENAME TABLE t1 TO t0;
|
||||||
|
|
||||||
CHECK TABLE t1;
|
|
||||||
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10';
|
|
||||||
|
|
||||||
SELECT * FROM t1 WHERE title = 'a5000';
|
|
||||||
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10000';
|
|
||||||
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10010';
|
|
||||||
|
|
||||||
DROP TABLE t1;
|
|
||||||
|
|
||||||
-- echo # Test Blob
|
-- echo # Test Blob
|
||||||
|
|
||||||
@ -104,16 +85,32 @@ INSERT INTO t1 VALUES
|
|||||||
|
|
||||||
SELECT CHAR_LENGTH(b) FROM t1;
|
SELECT CHAR_LENGTH(b) FROM t1;
|
||||||
|
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
--enable_info
|
||||||
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
|
--disable_info
|
||||||
|
|
||||||
--source include/restart_mysqld.inc
|
--source include/restart_mysqld.inc
|
||||||
|
|
||||||
CHECK TABLE t1;
|
CHECK TABLE t0,t1;
|
||||||
|
|
||||||
SELECT CHAR_LENGTH(b) FROM t1;
|
SELECT CHAR_LENGTH(b) FROM t1;
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
RENAME TABLE t0 to t1;
|
||||||
|
|
||||||
|
CHECK TABLE t1;
|
||||||
|
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10';
|
||||||
|
|
||||||
|
SELECT * FROM t1 WHERE title = 'a5000';
|
||||||
|
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10000';
|
||||||
|
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10010';
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
# Test Crash Recovery
|
# Test Crash Recovery
|
||||||
|
|
||||||
if ($row_format != 'COMPRESSED')
|
if ($row_format != 'COMPRESSED')
|
||||||
@ -140,17 +137,16 @@ if ($row_format == 'COMPRESSED')
|
|||||||
CALL populate_t1();
|
CALL populate_t1();
|
||||||
-- enable_query_log
|
-- enable_query_log
|
||||||
|
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect (hang,localhost,root);
|
||||||
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
# Write file to make mysql-test-run.pl start up the server again
|
send
|
||||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
||||||
|
|
||||||
--error 2013
|
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
|
|
||||||
--enable_reconnect
|
connection default;
|
||||||
--source include/wait_until_connected_again.inc
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
--disable_reconnect
|
let $shutdown_timeout=0;
|
||||||
|
--source include/restart_mysqld.inc
|
||||||
|
disconnect hang;
|
||||||
|
|
||||||
SELECT COUNT(*) FROM t1;
|
SELECT COUNT(*) FROM t1;
|
||||||
|
|
||||||
@ -194,17 +190,16 @@ INSERT INTO t1 VALUES
|
|||||||
|
|
||||||
SELECT CHAR_LENGTH(b) FROM t1;
|
SELECT CHAR_LENGTH(b) FROM t1;
|
||||||
|
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect (hang,localhost,root);
|
||||||
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
|
send
|
||||||
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
|
|
||||||
# Write file to make mysql-test-run.pl start up the server again
|
connection default;
|
||||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
--source include/restart_mysqld.inc
|
||||||
--error 2013
|
disconnect hang;
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
let $shutdown_timeout=60;
|
||||||
|
|
||||||
--enable_reconnect
|
|
||||||
--source include/wait_until_connected_again.inc
|
|
||||||
--disable_reconnect
|
|
||||||
|
|
||||||
CHECK TABLE t1;
|
CHECK TABLE t1;
|
||||||
|
|
||||||
@ -212,10 +207,4 @@ SELECT CHAR_LENGTH(b) FROM t1;
|
|||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
# Restore global variables
|
|
||||||
if ($row_format == 'COMPRESSED')
|
|
||||||
{
|
|
||||||
SET GLOBAL innodb_file_per_table=default;
|
|
||||||
}
|
|
||||||
|
|
||||||
DROP PROCEDURE populate_t1;
|
DROP PROCEDURE populate_t1;
|
||||||
|
@ -37,7 +37,9 @@ t1 CREATE TABLE `t1` (
|
|||||||
FULLTEXT KEY `b_2` (`b`,`c`)
|
FULLTEXT KEY `b_2` (`b`,`c`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
|
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
|
||||||
SET DEBUG_DBUG='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
|
SET DEBUG_SYNC='alter_table_copy_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
|
# create 32 secondary indexes
|
||||||
ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX(b,a,d,c),
|
ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX(b,a,d,c),
|
||||||
ADD INDEX(b,d,a,c),ADD INDEX(b,d,c,a),ADD INDEX(a,b,c,d),ADD INDEX(a,b,d,c),
|
ADD INDEX(b,d,a,c),ADD INDEX(b,d,c,a),ADD INDEX(a,b,c,d),ADD INDEX(a,b,d,c),
|
||||||
ADD INDEX(a,c,b,d),ADD INDEX(a,c,d,b),ADD INDEX(a,d,b,c),ADD INDEX(a,d,c,b),
|
ADD INDEX(a,c,b,d),ADD INDEX(a,c,d,b),ADD INDEX(a,d,b,c),ADD INDEX(a,d,c,b),
|
||||||
@ -47,7 +49,9 @@ ADD INDEX(d,b,a,c),ADD INDEX(d,b,c,a),ADD INDEX(d,c,a,b),ADD INDEX(d,c,b,a),
|
|||||||
ADD INDEX(a,b,c), ADD INDEX(a,c,b), ADD INDEX(a,c,d), ADD INDEX(a,d,c),
|
ADD INDEX(a,b,c), ADD INDEX(a,c,b), ADD INDEX(a,c,d), ADD INDEX(a,d,c),
|
||||||
ADD INDEX(a,b,d), ADD INDEX(a,d,b), ADD INDEX(b,c,d), ADD INDEX(b,d,c),
|
ADD INDEX(a,b,d), ADD INDEX(a,d,b), ADD INDEX(b,c,d), ADD INDEX(b,d,c),
|
||||||
ALGORITHM=COPY;
|
ALGORITHM=COPY;
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
#sql-temporary.frm
|
#sql-temporary.frm
|
||||||
#sql-temporary.ibd
|
#sql-temporary.ibd
|
||||||
FTS_INDEX_1.ibd
|
FTS_INDEX_1.ibd
|
||||||
|
@ -17,21 +17,9 @@ SELECT COUNT(*) FROM t1;
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
10000
|
10000
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
CHECK TABLE t1;
|
affected rows: 0
|
||||||
Table Op Msg_type Msg_text
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
test.t1 check status OK
|
RENAME TABLE t1 TO t0;
|
||||||
SELECT * FROM t1 WHERE title = 'a10';
|
|
||||||
class id title
|
|
||||||
10 10 a10
|
|
||||||
SELECT * FROM t1 WHERE title = 'a5000';
|
|
||||||
class id title
|
|
||||||
5000 5000 a5000
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10000';
|
|
||||||
class id title
|
|
||||||
10000 10000 a10000
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10010';
|
|
||||||
class id title
|
|
||||||
DROP TABLE t1;
|
|
||||||
# Test Blob
|
# Test Blob
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
a INT PRIMARY KEY,
|
a INT PRIMARY KEY,
|
||||||
@ -48,9 +36,12 @@ CHAR_LENGTH(b)
|
|||||||
20000
|
20000
|
||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
CHECK TABLE t1;
|
affected rows: 0
|
||||||
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
|
CHECK TABLE t0,t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
|
test.t0 check status OK
|
||||||
test.t1 check status OK
|
test.t1 check status OK
|
||||||
SELECT CHAR_LENGTH(b) FROM t1;
|
SELECT CHAR_LENGTH(b) FROM t1;
|
||||||
CHAR_LENGTH(b)
|
CHAR_LENGTH(b)
|
||||||
@ -59,14 +50,33 @@ CHAR_LENGTH(b)
|
|||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
RENAME TABLE t0 to t1;
|
||||||
|
CHECK TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10';
|
||||||
|
class id title
|
||||||
|
10 10 a10
|
||||||
|
SELECT * FROM t1 WHERE title = 'a5000';
|
||||||
|
class id title
|
||||||
|
5000 5000 a5000
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10000';
|
||||||
|
class id title
|
||||||
|
10000 10000 a10000
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10010';
|
||||||
|
class id title
|
||||||
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
class INT,
|
class INT,
|
||||||
id INT,
|
id INT,
|
||||||
title VARCHAR(100)
|
title VARCHAR(100)
|
||||||
) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
SELECT COUNT(*) FROM t1;
|
SELECT COUNT(*) FROM t1;
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
10000
|
10000
|
||||||
@ -104,9 +114,12 @@ CHAR_LENGTH(b)
|
|||||||
20000
|
20000
|
||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
CHECK TABLE t1;
|
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
|
||||||
@ -137,21 +150,9 @@ SELECT COUNT(*) FROM t1;
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
10000
|
10000
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
CHECK TABLE t1;
|
affected rows: 0
|
||||||
Table Op Msg_type Msg_text
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
test.t1 check status OK
|
RENAME TABLE t1 TO t0;
|
||||||
SELECT * FROM t1 WHERE title = 'a10';
|
|
||||||
class id title
|
|
||||||
10 10 a10
|
|
||||||
SELECT * FROM t1 WHERE title = 'a5000';
|
|
||||||
class id title
|
|
||||||
5000 5000 a5000
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10000';
|
|
||||||
class id title
|
|
||||||
10000 10000 a10000
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10010';
|
|
||||||
class id title
|
|
||||||
DROP TABLE t1;
|
|
||||||
# Test Blob
|
# Test Blob
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
a INT PRIMARY KEY,
|
a INT PRIMARY KEY,
|
||||||
@ -168,9 +169,12 @@ CHAR_LENGTH(b)
|
|||||||
20000
|
20000
|
||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
CHECK TABLE t1;
|
affected rows: 0
|
||||||
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
|
CHECK TABLE t0,t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
|
test.t0 check status OK
|
||||||
test.t1 check status OK
|
test.t1 check status OK
|
||||||
SELECT CHAR_LENGTH(b) FROM t1;
|
SELECT CHAR_LENGTH(b) FROM t1;
|
||||||
CHAR_LENGTH(b)
|
CHAR_LENGTH(b)
|
||||||
@ -179,14 +183,33 @@ CHAR_LENGTH(b)
|
|||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
RENAME TABLE t0 to t1;
|
||||||
|
CHECK TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10';
|
||||||
|
class id title
|
||||||
|
10 10 a10
|
||||||
|
SELECT * FROM t1 WHERE title = 'a5000';
|
||||||
|
class id title
|
||||||
|
5000 5000 a5000
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10000';
|
||||||
|
class id title
|
||||||
|
10000 10000 a10000
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10010';
|
||||||
|
class id title
|
||||||
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
class INT,
|
class INT,
|
||||||
id INT,
|
id INT,
|
||||||
title VARCHAR(100)
|
title VARCHAR(100)
|
||||||
) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
SELECT COUNT(*) FROM t1;
|
SELECT COUNT(*) FROM t1;
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
10000
|
10000
|
||||||
@ -224,9 +247,12 @@ CHAR_LENGTH(b)
|
|||||||
20000
|
20000
|
||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
CHECK TABLE t1;
|
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
|
||||||
@ -257,21 +283,9 @@ SELECT COUNT(*) FROM t1;
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
10000
|
10000
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
CHECK TABLE t1;
|
affected rows: 0
|
||||||
Table Op Msg_type Msg_text
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
test.t1 check status OK
|
RENAME TABLE t1 TO t0;
|
||||||
SELECT * FROM t1 WHERE title = 'a10';
|
|
||||||
class id title
|
|
||||||
10 10 a10
|
|
||||||
SELECT * FROM t1 WHERE title = 'a5000';
|
|
||||||
class id title
|
|
||||||
5000 5000 a5000
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10000';
|
|
||||||
class id title
|
|
||||||
10000 10000 a10000
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10010';
|
|
||||||
class id title
|
|
||||||
DROP TABLE t1;
|
|
||||||
# Test Blob
|
# Test Blob
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
a INT PRIMARY KEY,
|
a INT PRIMARY KEY,
|
||||||
@ -288,9 +302,12 @@ CHAR_LENGTH(b)
|
|||||||
20000
|
20000
|
||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
CHECK TABLE t1;
|
affected rows: 0
|
||||||
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
|
CHECK TABLE t0,t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
|
test.t0 check status OK
|
||||||
test.t1 check status OK
|
test.t1 check status OK
|
||||||
SELECT CHAR_LENGTH(b) FROM t1;
|
SELECT CHAR_LENGTH(b) FROM t1;
|
||||||
CHAR_LENGTH(b)
|
CHAR_LENGTH(b)
|
||||||
@ -299,14 +316,33 @@ CHAR_LENGTH(b)
|
|||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
RENAME TABLE t0 to t1;
|
||||||
|
CHECK TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10';
|
||||||
|
class id title
|
||||||
|
10 10 a10
|
||||||
|
SELECT * FROM t1 WHERE title = 'a5000';
|
||||||
|
class id title
|
||||||
|
5000 5000 a5000
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10000';
|
||||||
|
class id title
|
||||||
|
10000 10000 a10000
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10010';
|
||||||
|
class id title
|
||||||
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
class INT,
|
class INT,
|
||||||
id INT,
|
id INT,
|
||||||
title VARCHAR(100)
|
title VARCHAR(100)
|
||||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
SELECT COUNT(*) FROM t1;
|
SELECT COUNT(*) FROM t1;
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
10000
|
10000
|
||||||
@ -344,9 +380,12 @@ CHAR_LENGTH(b)
|
|||||||
20000
|
20000
|
||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
CHECK TABLE t1;
|
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
|
||||||
@ -378,21 +417,9 @@ SELECT COUNT(*) FROM t1;
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
10000
|
10000
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
CHECK TABLE t1;
|
affected rows: 0
|
||||||
Table Op Msg_type Msg_text
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
test.t1 check status OK
|
RENAME TABLE t1 TO t0;
|
||||||
SELECT * FROM t1 WHERE title = 'a10';
|
|
||||||
class id title
|
|
||||||
10 10 a10
|
|
||||||
SELECT * FROM t1 WHERE title = 'a5000';
|
|
||||||
class id title
|
|
||||||
5000 5000 a5000
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10000';
|
|
||||||
class id title
|
|
||||||
10000 10000 a10000
|
|
||||||
SELECT * FROM t1 WHERE title = 'a10010';
|
|
||||||
class id title
|
|
||||||
DROP TABLE t1;
|
|
||||||
# Test Blob
|
# Test Blob
|
||||||
SET GLOBAL innodb_file_per_table=1;
|
SET GLOBAL innodb_file_per_table=1;
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
@ -410,9 +437,12 @@ CHAR_LENGTH(b)
|
|||||||
20000
|
20000
|
||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
CHECK TABLE t1;
|
affected rows: 0
|
||||||
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
|
CHECK TABLE t0,t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
|
test.t0 check status OK
|
||||||
test.t1 check status OK
|
test.t1 check status OK
|
||||||
SELECT CHAR_LENGTH(b) FROM t1;
|
SELECT CHAR_LENGTH(b) FROM t1;
|
||||||
CHAR_LENGTH(b)
|
CHAR_LENGTH(b)
|
||||||
@ -421,15 +451,34 @@ CHAR_LENGTH(b)
|
|||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
RENAME TABLE t0 to t1;
|
||||||
|
CHECK TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10';
|
||||||
|
class id title
|
||||||
|
10 10 a10
|
||||||
|
SELECT * FROM t1 WHERE title = 'a5000';
|
||||||
|
class id title
|
||||||
|
5000 5000 a5000
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10000';
|
||||||
|
class id title
|
||||||
|
10000 10000 a10000
|
||||||
|
SELECT * FROM t1 WHERE title = 'a10010';
|
||||||
|
class id title
|
||||||
|
DROP TABLE t1;
|
||||||
SET GLOBAL innodb_file_per_table=1;
|
SET GLOBAL innodb_file_per_table=1;
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
class INT,
|
class INT,
|
||||||
id INT,
|
id INT,
|
||||||
title VARCHAR(100)
|
title VARCHAR(100)
|
||||||
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
|
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
CREATE INDEX idx_title ON t1(title);
|
CREATE INDEX idx_title ON t1(title);
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
SELECT COUNT(*) FROM t1;
|
SELECT COUNT(*) FROM t1;
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
10000
|
10000
|
||||||
@ -468,9 +517,12 @@ CHAR_LENGTH(b)
|
|||||||
20000
|
20000
|
||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
SET debug_dbug='+d,crash_commit_before';
|
connect hang,localhost,root;
|
||||||
ALTER TABLE t1 DROP COLUMN c;
|
SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
ALTER TABLE t1 DROP COLUMN c, FORCE;
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
disconnect hang;
|
||||||
CHECK TABLE t1;
|
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
|
||||||
@ -481,5 +533,4 @@ CHAR_LENGTH(b)
|
|||||||
40000
|
40000
|
||||||
60000
|
60000
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET GLOBAL innodb_file_per_table=default;
|
|
||||||
DROP PROCEDURE populate_t1;
|
DROP PROCEDURE populate_t1;
|
||||||
|
@ -37,11 +37,11 @@ SELECT * FROM t1 WHERE MATCH(b,c) AGAINST ('column');
|
|||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
|
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
|
||||||
|
|
||||||
# crash right after the last write_row(), before the first commit of ALTER TABLE
|
# kill right after the last write_row(), before the first commit of ALTER TABLE
|
||||||
--source include/expect_crash.inc
|
connect (hang,localhost,root);
|
||||||
|
|
||||||
SET DEBUG_DBUG='+d,crash_commit_before';
|
SET DEBUG_SYNC='alter_table_copy_trans_commit SIGNAL hung WAIT_FOR ever';
|
||||||
--error 2013
|
send
|
||||||
# create 32 secondary indexes
|
# create 32 secondary indexes
|
||||||
ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX(b,a,d,c),
|
ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX(b,a,d,c),
|
||||||
ADD INDEX(b,d,a,c),ADD INDEX(b,d,c,a),ADD INDEX(a,b,c,d),ADD INDEX(a,b,d,c),
|
ADD INDEX(b,d,a,c),ADD INDEX(b,d,c,a),ADD INDEX(a,b,c,d),ADD INDEX(a,b,d,c),
|
||||||
@ -53,8 +53,13 @@ ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX
|
|||||||
ADD INDEX(a,b,d), ADD INDEX(a,d,b), ADD INDEX(b,c,d), ADD INDEX(b,d,c),
|
ADD INDEX(a,b,d), ADD INDEX(a,d,b), ADD INDEX(b,c,d), ADD INDEX(b,d,c),
|
||||||
ALGORITHM=COPY;
|
ALGORITHM=COPY;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC='now WAIT_FOR hung';
|
||||||
|
let $shutdown_timeout=0;
|
||||||
--let $restart_parameters= --innodb-force-recovery=3
|
--let $restart_parameters= --innodb-force-recovery=3
|
||||||
--source include/start_mysqld.inc
|
--source include/restart_mysqld.inc
|
||||||
|
disconnect hang;
|
||||||
|
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-[0-9a-f_]*/#sql-temporary/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/
|
||||||
--list_files $datadir/test
|
--list_files $datadir/test
|
||||||
|
@ -9788,6 +9788,7 @@ end_temporary:
|
|||||||
(ulong) (copied + deleted), (ulong) deleted,
|
(ulong) (copied + deleted), (ulong) deleted,
|
||||||
(ulong) thd->get_stmt_da()->current_statement_warn_count());
|
(ulong) thd->get_stmt_da()->current_statement_warn_count());
|
||||||
my_ok(thd, copied + deleted, 0L, alter_ctx.tmp_name);
|
my_ok(thd, copied + deleted, 0L, alter_ctx.tmp_name);
|
||||||
|
DEBUG_SYNC(thd, "alter_table_inplace_trans_commit");
|
||||||
DBUG_RETURN(false);
|
DBUG_RETURN(false);
|
||||||
|
|
||||||
err_new_table_cleanup:
|
err_new_table_cleanup:
|
||||||
@ -9889,12 +9890,14 @@ bool mysql_trans_commit_alter_copy_data(THD *thd)
|
|||||||
uint save_unsafe_rollback_flags;
|
uint save_unsafe_rollback_flags;
|
||||||
DBUG_ENTER("mysql_trans_commit_alter_copy_data");
|
DBUG_ENTER("mysql_trans_commit_alter_copy_data");
|
||||||
|
|
||||||
/* Save flags as transcommit_implicit_are_deleting_them */
|
/* Save flags as trans_commit_implicit are deleting them */
|
||||||
save_unsafe_rollback_flags= thd->transaction.stmt.m_unsafe_rollback_flags;
|
save_unsafe_rollback_flags= thd->transaction.stmt.m_unsafe_rollback_flags;
|
||||||
|
|
||||||
|
DEBUG_SYNC(thd, "alter_table_copy_trans_commit");
|
||||||
|
|
||||||
if (ha_enable_transaction(thd, TRUE))
|
if (ha_enable_transaction(thd, TRUE))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Ensure that the new table is saved properly to disk before installing
|
Ensure that the new table is saved properly to disk before installing
|
||||||
the new .frm.
|
the new .frm.
|
||||||
|
Reference in New Issue
Block a user