Commit 2fe40a7a authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-18009 Missing redo log flush in innodb.instant_alter_crash

Ensure that the 'auxiliary transactions' that are there for
flushing the incomplete undo log of the to-be-recovered DDL
transactions are actually making modifications.
parent 505f2831
...@@ -5,7 +5,7 @@ FLUSH TABLES; ...@@ -5,7 +5,7 @@ FLUSH TABLES;
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE) CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
ENGINE=InnoDB ROW_FORMAT=REDUNDANT; ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(0,2);
BEGIN; BEGIN;
INSERT INTO t2 VALUES(2,1); INSERT INTO t2 VALUES(2,1);
ALTER TABLE t2 ADD COLUMN (c3 TEXT NOT NULL DEFAULT 'De finibus bonorum'); ALTER TABLE t2 ADD COLUMN (c3 TEXT NOT NULL DEFAULT 'De finibus bonorum');
...@@ -15,16 +15,17 @@ ALTER TABLE t1 ADD COLUMN (c3 TEXT NOT NULL DEFAULT ' et malorum'); ...@@ -15,16 +15,17 @@ ALTER TABLE t1 ADD COLUMN (c3 TEXT NOT NULL DEFAULT ' et malorum');
connection default; connection default;
SET DEBUG_SYNC='now WAIT_FOR ddl'; SET DEBUG_SYNC='now WAIT_FOR ddl';
SET GLOBAL innodb_flush_log_at_trx_commit=1; SET GLOBAL innodb_flush_log_at_trx_commit=1;
COMMIT; INSERT INTO t2 VALUES(3,4,'accusantium doloremque laudantium');
# Kill the server # Kill the server
disconnect ddl; disconnect ddl;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1; SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SELECT * FROM t1; SELECT * FROM t1;
id c2 id c2
1 2 0 2
SELECT * FROM t2; SELECT * FROM t2;
id c2 c3 id c2 c3
2 1 De finibus bonorum 2 1 De finibus bonorum
3 4 accusantium doloremque laudantium
BEGIN; BEGIN;
DELETE FROM t1; DELETE FROM t1;
ROLLBACK; ROLLBACK;
...@@ -37,16 +38,18 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere'; ...@@ -37,16 +38,18 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere';
connection default; connection default;
SET DEBUG_SYNC='now WAIT_FOR ddl'; SET DEBUG_SYNC='now WAIT_FOR ddl';
SET GLOBAL innodb_flush_log_at_trx_commit=1; SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1; UPDATE t1 SET c2=c2+1;
# Kill the server # Kill the server
disconnect ddl; disconnect ddl;
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1; SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SELECT * FROM t1; SELECT * FROM t1;
id c2 id c2
0 3
SELECT * FROM t2; SELECT * FROM t2;
id c2 c3 id c2 c3
2 1 De finibus bonorum 2 1 De finibus bonorum
3 4 accusantium doloremque laudantium
16 1551 Omnium enim rerum 16 1551 Omnium enim rerum
128 1571 principia parva sunt 128 1571 principia parva sunt
BEGIN; BEGIN;
...@@ -67,11 +70,13 @@ DELETE FROM t1; ...@@ -67,11 +70,13 @@ DELETE FROM t1;
disconnect ddl; disconnect ddl;
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1; SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
FOUND 3 /\[Note\] InnoDB: Rolled back recovered transaction / in mysqld.1.err
SELECT * FROM t1; SELECT * FROM t1;
id c2 id c2
SELECT * FROM t2; SELECT * FROM t2;
id c2 id c2
2 1 2 1
3 4
64 42 64 42
16 1551 16 1551
128 1571 128 1571
...@@ -87,7 +92,7 @@ N_RECS=0; LEVEL=0 ...@@ -87,7 +92,7 @@ N_RECS=0; LEVEL=0
header=0x010000030074 (id=0x696e66696d756d00) header=0x010000030074 (id=0x696e66696d756d00)
header=0x010008030000 (id=0x73757072656d756d00) header=0x010008030000 (id=0x73757072656d756d00)
t2 clustered index root page(type 18): t2 clustered index root page(type 18):
N_RECS=6; LEVEL=0 N_RECS=7; LEVEL=0
header=0x01000003008f (id=0x0000000000000000) header=0x01000003008f (id=0x0000000000000000)
header=0x3000100c00d4 (id=0x80000000, header=0x3000100c00d4 (id=0x80000000,
DB_TRX_ID=0x000000000000, DB_TRX_ID=0x000000000000,
...@@ -99,26 +104,31 @@ header=0x0000180900f4 (id=0x80000002, ...@@ -99,26 +104,31 @@ header=0x0000180900f4 (id=0x80000002,
DB_TRX_ID=0x000000000000, DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000, DB_ROLL_PTR=0x80000000000000,
c2=0x80000001) c2=0x80000001)
header=0x0000200b0124 (id=0x80000010, header=0x0000200b0135 (id=0x80000003,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x80000004,
c3=0x6163637573616e7469756d20646f6c6f72656d717565206c617564616e7469756d)
header=0x0000280b0165 (id=0x80000010,
DB_TRX_ID=0x000000000000, DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000, DB_ROLL_PTR=0x80000000000000,
c2=0x8000060f, c2=0x8000060f,
c3=0x4f6d6e69756d20656e696d20726572756d) c3=0x4f6d6e69756d20656e696d20726572756d)
header=0x000028090144 (id=0x80000040, header=0x000030090185 (id=0x80000040,
DB_TRX_ID=0x000000000000, DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000, DB_ROLL_PTR=0x80000000000000,
c2=0x8000002a) c2=0x8000002a)
header=0x0000300b0179 (id=0x80000080, header=0x0000380b01ba (id=0x80000080,
DB_TRX_ID=0x000000000000, DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000, DB_ROLL_PTR=0x80000000000000,
c2=0x80000623, c2=0x80000623,
c3=0x207072696e63697069612070617276612073756e74) c3=0x207072696e63697069612070617276612073756e74)
header=0x0000380b0074 (id=0x8000015b, header=0x0000400b0074 (id=0x8000015b,
DB_TRX_ID=0x000000000000, DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000, DB_ROLL_PTR=0x80000000000000,
c2=0x8000814d, c2=0x8000814d,
c3=0x206574206d616c6f72756d) c3=0x206574206d616c6f72756d)
header=0x070008030000 (id=0x000000000000000100) header=0x080008030000 (id=0x000000000000000100)
UNLOCK TABLES; UNLOCK TABLES;
DELETE FROM t2; DELETE FROM t2;
InnoDB 0 transactions not purged InnoDB 0 transactions not purged
......
...@@ -16,7 +16,7 @@ let MYSQLD_DATADIR=`select @@datadir`; ...@@ -16,7 +16,7 @@ let MYSQLD_DATADIR=`select @@datadir`;
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE) CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
ENGINE=InnoDB ROW_FORMAT=REDUNDANT; ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(0,2);
BEGIN; BEGIN;
INSERT INTO t2 VALUES(2,1); INSERT INTO t2 VALUES(2,1);
ALTER TABLE t2 ADD COLUMN (c3 TEXT NOT NULL DEFAULT 'De finibus bonorum'); ALTER TABLE t2 ADD COLUMN (c3 TEXT NOT NULL DEFAULT 'De finibus bonorum');
...@@ -29,7 +29,7 @@ ALTER TABLE t1 ADD COLUMN (c3 TEXT NOT NULL DEFAULT ' et malorum'); ...@@ -29,7 +29,7 @@ ALTER TABLE t1 ADD COLUMN (c3 TEXT NOT NULL DEFAULT ' et malorum');
connection default; connection default;
SET DEBUG_SYNC='now WAIT_FOR ddl'; SET DEBUG_SYNC='now WAIT_FOR ddl';
SET GLOBAL innodb_flush_log_at_trx_commit=1; SET GLOBAL innodb_flush_log_at_trx_commit=1;
COMMIT; INSERT INTO t2 VALUES(3,4,'accusantium doloremque laudantium');
--source include/kill_mysqld.inc --source include/kill_mysqld.inc
disconnect ddl; disconnect ddl;
...@@ -54,7 +54,7 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere'; ...@@ -54,7 +54,7 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere';
connection default; connection default;
SET DEBUG_SYNC='now WAIT_FOR ddl'; SET DEBUG_SYNC='now WAIT_FOR ddl';
SET GLOBAL innodb_flush_log_at_trx_commit=1; SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1; UPDATE t1 SET c2=c2+1;
--source include/kill_mysqld.inc --source include/kill_mysqld.inc
disconnect ddl; disconnect ddl;
...@@ -91,6 +91,10 @@ disconnect ddl; ...@@ -91,6 +91,10 @@ disconnect ddl;
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1; SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN= \[Note\] InnoDB: Rolled back recovered transaction ;
-- source include/search_pattern_in_file.inc
SELECT * FROM t1; SELECT * FROM t1;
SELECT * FROM t2; SELECT * FROM t2;
BEGIN; BEGIN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment