[Commits] 1d56d875fe2: MDEV-15740: InnoDB does not flush redo log when it shoul

jan jan.lindstrom at mariadb.com
Mon Jan 7 12:22:01 EET 2019


revision-id: 1d56d875fe28f34cefc1bb4e162331ae9f4ce9bb (mariadb-10.1.37-54-g1d56d875fe2)
parent(s): 7158edcba3af3766e9329f9927ce4adfd2a40bf8
author: Jan Lindström
committer: Jan Lindström
timestamp: 2019-01-07 12:12:30 +0200
message:

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

---
 mysql-test/suite/galera/disabled.def                               | 3 ---
 mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result | 4 ++++
 mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result     | 4 ++++
 mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test   | 5 +++++
 mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test       | 5 +++++
 storage/innobase/trx/trx0trx.cc                                    | 6 ++++++
 storage/xtradb/trx/trx0trx.cc                                      | 6 ++++++
 7 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 94256dd88d7..53363f0a2ea 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -20,9 +20,6 @@ galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
 GAL-419 : 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_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.MW-329 : wsrep_local_replays not stable
 MW-416 : MDEV-13549 Galera test failures
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result b/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
index 30ee5772411..ca81d7d8164 100644
--- a/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
+++ b/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
@@ -1,3 +1,7 @@
+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;
 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
 SET SESSION wsrep_sync_wait = 0;
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
index 868b39bfbd6..1483c5d1de5 100644
--- a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
+++ b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
@@ -1,3 +1,7 @@
+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;
 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
 CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
index b7fd9cf3aed..7eb25d001f5 100644
--- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
+++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
@@ -5,6 +5,11 @@
 --source include/galera_cluster.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;
 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
 
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
index 08165f30f7d..ac28a070cf9 100644
--- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
+++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
@@ -7,6 +7,11 @@
 --source include/big_test.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;
 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
 CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 58dc9445546..f36aabba8b4 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -2300,6 +2300,12 @@ trx_get_trx_by_xid_low(
 		    && memcmp(xid->data, trx->xid.data,
 			      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
 			will not find it. */
 			trx->xid.null();
diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc
index 6a033fbeb09..17cba81daf3 100644
--- a/storage/xtradb/trx/trx0trx.cc
+++ b/storage/xtradb/trx/trx0trx.cc
@@ -2578,6 +2578,12 @@ trx_get_trx_by_xid_low(
 		    && memcmp(xid->data, trx->xid.data,
 			      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
 			will not find it. */
 			trx->xid.null();


More information about the commits mailing list