Bug #75410 InnoDB fails to update update_time after XA COMMIT
Submitted: 5 Jan 2015 11:22 Modified: 5 Jan 2015 19:48
Reporter: Marko Mäkelä Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[5 Jan 2015 11:22] Marko Mäkelä
Description:
The update_time metadata that was implemented in WL#6658 is not updated for XA COMMIT of recovered transactions that were in XA PREPARE state.

How to repeat:
See the test case (innodb.innodb_update_time) that contains a misleading comment about this.

Suggested fix:
This patch will also remove the innodb_ prefix from the test file names:

diff --git a/mysql-test/suite/innodb/r/update_time.result b/mysql-test/suite/innodb/r/update_time.result
index dcb925f..0c6fc67 100644
--- a/mysql-test/suite/innodb/r/update_time.result
+++ b/mysql-test/suite/innodb/r/update_time.result
@@ -46,7 +46,8 @@ SELECT update_time FROM information_schema.tables WHERE table_name = 't';
 update_time
 NULL
 XA COMMIT 'xatrx';
-SELECT update_time FROM information_schema.tables WHERE table_name = 't';
-update_time
-NULL
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+COUNT(*)
+1
 DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/update_time.test b/mysql-test/suite/innodb/t/update_time.test
index 9f3a97f..922fd40 100644
--- a/mysql-test/suite/innodb/t/update_time.test
+++ b/mysql-test/suite/innodb/t/update_time.test
@@ -73,8 +73,7 @@ SELECT update_time FROM information_schema.tables WHERE table_name = 't';
 
 XA COMMIT 'xatrx';
 
-# The result from this query may change once update_time becomes persistent
-# (WL#6917).
-SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
 
 DROP TABLE t;
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 7c4b1a8..5005fe7 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -723,6 +723,9 @@ trx_resurrect_table_locks(
 				continue;
 			}
 
+			if (trx->state == TRX_STATE_PREPARED) {
+				trx->mod_tables.insert(table);
+			}
 			lock_table_ix_resurrect(table, trx);
 
 			DBUG_PRINT("ib_trx",
[5 Jan 2015 19:48] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.6 release, and here's the changelog entry:

The "INFORMATION_SCHEMA.TABLES" "UPDATE_TIME" field, which was enabled
for "InnoDB" tables in MySQL 5.7.2, was not updated for "XA COMMIT" of
recovered transactions that were in "XA PREPARE" state.