Commit 1d56d875 authored by Jan Lindström's avatar Jan Lindström

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
parent 7158edcb
...@@ -20,9 +20,6 @@ galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB ...@@ -20,9 +20,6 @@ galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
GAL-419 : MDEV-13549 Galera test failures GAL-419 : MDEV-13549 Galera test failures
galera_var_notify_cmd : MDEV-13549 Galera test failures galera_var_notify_cmd : MDEV-13549 Galera test failures
galera_as_slave_replication_bundle : MDEV-13549 Galera test failures galera_as_slave_replication_bundle : MDEV-13549 Galera test failures
galera_gcache_recover : MDEV-13549 Galera test failures
galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures
galera_gcache_recover_manytrx : MDEV-13549 Galera test failures
galera_ssl_upgrade : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures
galera.MW-329 : wsrep_local_replays not stable galera.MW-329 : wsrep_local_replays not stable
MW-416 : MDEV-13549 Galera test failures MW-416 : MDEV-13549 Galera test failures
......
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
call mtr.add_suppression("InnoDB: Resizing redo log from *");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
......
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
call mtr.add_suppression("InnoDB: Resizing redo log from *");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
......
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/big_test.inc --source include/big_test.inc
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
call mtr.add_suppression("InnoDB: Resizing redo log from *");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
......
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
--source include/big_test.inc --source include/big_test.inc
--source include/have_log_bin.inc --source include/have_log_bin.inc
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
call mtr.add_suppression("InnoDB: Resizing redo log from *");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
......
...@@ -2300,6 +2300,12 @@ trx_get_trx_by_xid_low( ...@@ -2300,6 +2300,12 @@ trx_get_trx_by_xid_low(
&& memcmp(xid->data, trx->xid.data, && memcmp(xid->data, trx->xid.data,
xid->gtrid_length + xid->bqual_length) == 0) { xid->gtrid_length + xid->bqual_length) == 0) {
#ifdef WITH_WSREP
/* The commit of a prepared recovered Galera
transaction needs a valid trx->xid for
invoking trx_sys_update_wsrep_checkpoint(). */
if (wsrep_is_wsrep_xid(&trx->xid)) break;
#endif
/* Invalidate the XID, so that subsequent calls /* Invalidate the XID, so that subsequent calls
will not find it. */ will not find it. */
trx->xid.null(); trx->xid.null();
......
...@@ -2578,6 +2578,12 @@ trx_get_trx_by_xid_low( ...@@ -2578,6 +2578,12 @@ trx_get_trx_by_xid_low(
&& memcmp(xid->data, trx->xid.data, && memcmp(xid->data, trx->xid.data,
xid->gtrid_length + xid->bqual_length) == 0) { xid->gtrid_length + xid->bqual_length) == 0) {
#ifdef WITH_WSREP
/* The commit of a prepared recovered Galera
transaction needs a valid trx->xid for
invoking trx_sys_update_wsrep_checkpoint(). */
if (wsrep_is_wsrep_xid(&trx->xid)) break;
#endif
/* Invalidate the XID, so that subsequent calls /* Invalidate the XID, so that subsequent calls
will not find it. */ will not find it. */
trx->xid.null(); trx->xid.null();
......
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