Skip to content

Commit 646a3bd

Browse files
committed
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. This is a backport of 2fe40a7 from MariaDB 10.4.
1 parent 09aa5d3 commit 646a3bd

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FLUSH TABLES;
55
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
66
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
77
CREATE TABLE t2 LIKE t1;
8-
INSERT INTO t1 VALUES(1,2);
8+
INSERT INTO t1 VALUES(0,2);
99
BEGIN;
1010
INSERT INTO t2 VALUES(2,1);
1111
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');
1515
connection default;
1616
SET DEBUG_SYNC='now WAIT_FOR ddl';
1717
SET GLOBAL innodb_flush_log_at_trx_commit=1;
18-
COMMIT;
18+
INSERT INTO t2 VALUES(3,4,'accusantium doloremque laudantium');
1919
# Kill the server
2020
disconnect ddl;
2121
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
2222
SELECT * FROM t1;
2323
id c2
24-
1 2
24+
0 2
2525
SELECT * FROM t2;
2626
id c2 c3
2727
2 1 De finibus bonorum
28+
3 4 accusantium doloremque laudantium
2829
BEGIN;
2930
DELETE FROM t1;
3031
ROLLBACK;
@@ -41,11 +42,13 @@ DELETE FROM t1;
4142
disconnect ddl;
4243
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
4344
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
45+
FOUND 2 /\[Note\] InnoDB: Rolled back recovered transaction / in mysqld.1.err
4446
SELECT * FROM t1;
4547
id c2
4648
SELECT * FROM t2;
4749
id c2 c3
4850
2 1 De finibus bonorum
51+
3 4 accusantium doloremque laudantium
4952
64 42 De finibus bonorum
5053
347 33101 et malorum
5154
BEGIN;
@@ -59,27 +62,32 @@ N_RECS=0; LEVEL=0
5962
header=0x010000030074 (id=0x696e66696d756d00)
6063
header=0x010008030000 (id=0x73757072656d756d00)
6164
t2 clustered index root page(type 18):
62-
N_RECS=4; LEVEL=0
65+
N_RECS=5; LEVEL=0
6366
header=0x010000030088 (id=0x696e66696d756d00)
6467
header=0x1000100b00b9 (id=0x80000000,
6568
DB_TRX_ID=0x000000000000,
6669
DB_ROLL_PTR=0x80000000000000,
6770
c2=NULL(4 bytes),
6871
c3=0x44652066696e6962757320626f6e6f72756d)
69-
header=0x0000180900d8 (id=0x80000002,
72+
header=0x0000180900d9 (id=0x80000002,
7073
DB_TRX_ID=0x000000000000,
7174
DB_ROLL_PTR=0x80000000000000,
7275
c2=0x80000001)
73-
header=0x0000200900f8 (id=0x80000040,
76+
header=0x0000200b0119 (id=0x80000003,
77+
DB_TRX_ID=0x000000000000,
78+
DB_ROLL_PTR=0x80000000000000,
79+
c2=0x80000004,
80+
c3=0x6163637573616e7469756d20646f6c6f72656d717565206c617564616e7469756d)
81+
header=0x000028090139 (id=0x80000040,
7482
DB_TRX_ID=0x000000000000,
7583
DB_ROLL_PTR=0x80000000000000,
7684
c2=0x8000002a)
77-
header=0x0000280b0074 (id=0x8000015b,
85+
header=0x0000300b0074 (id=0x8000015b,
7886
DB_TRX_ID=0x000000000000,
7987
DB_ROLL_PTR=0x80000000000000,
8088
c2=0x8000814d,
8189
c3=0x206574206d616c6f72756d)
82-
header=0x050008030000 (id=0x73757072656d756d00)
90+
header=0x060008030000 (id=0x73757072656d756d00)
8391
UNLOCK TABLES;
8492
DELETE FROM t2;
8593
InnoDB 0 transactions not purged

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let MYSQLD_DATADIR=`select @@datadir`;
1616
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
1717
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
1818
CREATE TABLE t2 LIKE t1;
19-
INSERT INTO t1 VALUES(1,2);
19+
INSERT INTO t1 VALUES(0,2);
2020
BEGIN;
2121
INSERT INTO t2 VALUES(2,1);
2222
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');
2929
connection default;
3030
SET DEBUG_SYNC='now WAIT_FOR ddl';
3131
SET GLOBAL innodb_flush_log_at_trx_commit=1;
32-
COMMIT;
32+
INSERT INTO t2 VALUES(3,4,'accusantium doloremque laudantium');
3333

3434
--source include/kill_mysqld.inc
3535
disconnect ddl;
@@ -62,6 +62,10 @@ disconnect ddl;
6262
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
6363
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
6464

65+
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
66+
let SEARCH_PATTERN= \[Note\] InnoDB: Rolled back recovered transaction ;
67+
-- source include/search_pattern_in_file.inc
68+
6569
SELECT * FROM t1;
6670
SELECT * FROM t2;
6771
BEGIN;

0 commit comments

Comments
 (0)