Skip to content

Commit 1d56d87

Browse files
author
Jan Lindström
committed
MDEV-15740: InnoDB does not flush redo log when it shoul
During database recovery, a transaction with wsrep XID is recovered from InnoDB in prepared state. However, when the transaction is looked up with trx_get_trx_by_xid() in innobase_commit_by_xid(), trx->xid gets cleared in trx_get_trx_by_xid_low() and commit time serialization history write does not update the wsrep XID in trx sys header for that recovered trx. As a result the transaction gets committed during recovery but the wsrep position does not get updated appropriately. As a fix, we preserve trx->xid for Galera over transaction commit in recovery phase. Fix authored by: Teemu Ollakka (GaleraCluster) and Marko Mäkelä. modified: mysql-test/suite/galera/disabled.def modified: mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result modified: mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result modified: mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test modified: mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test modified: storage/innobase/trx/trx0trx.cc modified: storage/xtradb/trx/trx0trx.cc
1 parent 7158edc commit 1d56d87

File tree

7 files changed

+30
-3
lines changed

7 files changed

+30
-3
lines changed

mysql-test/suite/galera/disabled.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
2020
GAL-419 : MDEV-13549 Galera test failures
2121
galera_var_notify_cmd : MDEV-13549 Galera test failures
2222
galera_as_slave_replication_bundle : MDEV-13549 Galera test failures
23-
galera_gcache_recover : MDEV-13549 Galera test failures
24-
galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures
25-
galera_gcache_recover_manytrx : MDEV-13549 Galera test failures
2623
galera_ssl_upgrade : MDEV-13549 Galera test failures
2724
galera.MW-329 : wsrep_local_replays not stable
2825
MW-416 : MDEV-13549 Galera test failures

mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
2+
call mtr.add_suppression("InnoDB: Resizing redo log from *");
3+
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
4+
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
15
SET SESSION wsrep_sync_wait = 0;
26
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
37
SET SESSION wsrep_sync_wait = 0;

mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
2+
call mtr.add_suppression("InnoDB: Resizing redo log from *");
3+
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
4+
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
15
SET SESSION wsrep_sync_wait = 0;
26
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
37
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;

mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
--source include/galera_cluster.inc
66
--source include/big_test.inc
77

8+
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
9+
call mtr.add_suppression("InnoDB: Resizing redo log from *");
10+
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
11+
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
12+
813
SET SESSION wsrep_sync_wait = 0;
914
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
1015

mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
--source include/big_test.inc
88
--source include/have_log_bin.inc
99

10+
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
11+
call mtr.add_suppression("InnoDB: Resizing redo log from *");
12+
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
13+
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
14+
1015
SET SESSION wsrep_sync_wait = 0;
1116
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
1217
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;

storage/innobase/trx/trx0trx.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,12 @@ trx_get_trx_by_xid_low(
23002300
&& memcmp(xid->data, trx->xid.data,
23012301
xid->gtrid_length + xid->bqual_length) == 0) {
23022302

2303+
#ifdef WITH_WSREP
2304+
/* The commit of a prepared recovered Galera
2305+
transaction needs a valid trx->xid for
2306+
invoking trx_sys_update_wsrep_checkpoint(). */
2307+
if (wsrep_is_wsrep_xid(&trx->xid)) break;
2308+
#endif
23032309
/* Invalidate the XID, so that subsequent calls
23042310
will not find it. */
23052311
trx->xid.null();

storage/xtradb/trx/trx0trx.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,6 +2578,12 @@ trx_get_trx_by_xid_low(
25782578
&& memcmp(xid->data, trx->xid.data,
25792579
xid->gtrid_length + xid->bqual_length) == 0) {
25802580

2581+
#ifdef WITH_WSREP
2582+
/* The commit of a prepared recovered Galera
2583+
transaction needs a valid trx->xid for
2584+
invoking trx_sys_update_wsrep_checkpoint(). */
2585+
if (wsrep_is_wsrep_xid(&trx->xid)) break;
2586+
#endif
25812587
/* Invalidate the XID, so that subsequent calls
25822588
will not find it. */
25832589
trx->xid.null();

0 commit comments

Comments
 (0)