[MDEV-14477] InnoDB update_time is wrongly updated after partial rollback or internal COMMIT Created: 2017-11-23  Updated: 2024-02-07  Resolved: 2017-11-23

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2.2, 10.3.0
Fix Version/s: 10.3.3

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
causes MDEV-24811 Assertion `find(table)' failed in dic... Closed
is caused by MDEV-4697 UPDATE_TIME field for XtraDB / InnoDB Closed
Relates
relates to MDEV-33401 fts_savepoint_t::tables seems to dupl... Open

 Description   

The non-persistent UPDATE_TIME for InnoDB tables is not being updated consistently at transaction commit.

If a transaction is partly rolled back so that in the end it will not modify a table that it intended to modify, the update_time will be updated nevertheless. This will also happen when InnoDB fails to write an undo log record for the intended modification.

If a transaction is committed internally in InnoDB, instead of being committed from the SQL interface, then the trx_t::mod_tables will not be applied to the update_time of the tables.

The problem can be demonstrated with the following:

diff --git a/mysql-test/suite/innodb/t/update_time_wl6658.test b/mysql-test/suite/innodb/t/update_time_wl6658.test
index 0b2b94ae2a9..d7ecfc4961f 100644
--- a/mysql-test/suite/innodb/t/update_time_wl6658.test
+++ b/mysql-test/suite/innodb/t/update_time_wl6658.test
@@ -187,8 +187,9 @@ SELECT update_time
 FROM information_schema.tables WHERE table_name='tab1i';
 
 BEGIN WORK;
-INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10);
+DELETE FROM tab1i;
 SAVEPOINT A;
+INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10);
 INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40);
 SAVEPOINT B;
 INSERT INTO tab2 VALUES(3,'IBM','NAIL',70);

With this change to the test, the end effect of the transaction (which will do ROLLBACK TO A before COMMIT) is that it will not modify tab2. Yet, the UPDATE_TIME of tab2 is affected.
If the SAVEPOINT A were at the very beginning of the transaction, then it would work correctly; a full ROLLBACK will empty the trx_t::mod_tables.



 Comments   
Comment by Marko Mäkelä [ 2017-11-23 ]

I wrote the fix yesterday and tested it today after importing the tests from MySQL 5.7 (MDEV-4697) and after filing this issue.

Generated at Thu Feb 08 08:13:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.