Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3.1
-
10.3.6-1
Description
When an InnoDB transaction is about to update a record, two steps will be performed before the modification of the clustered index tree can start:
- the transaction must be able to acquire an exclusive lock on the record
- writing an undo log record for rolling back the operation must succeed
This bug is about the undo log processing. We can get to that phase only if the record was last modified by a committed transaction.
In the scenario of this bug, that committed transaction would still exist in the system in the purge queue, and the record would still carry a nonzero DB_TRX_ID:
diff --git a/mysql-test/suite/innodb/t/dml_purge.test b/mysql-test/suite/innodb/t/dml_purge.test
|
index 93b7f56111c..07d071517ff 100644
|
--- a/mysql-test/suite/innodb/t/dml_purge.test
|
+++ b/mysql-test/suite/innodb/t/dml_purge.test
|
@@ -15,11 +15,23 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
CREATE TABLE t1(a INT PRIMARY KEY, b INT NOT NULL)
|
ROW_FORMAT=REDUNDANT ENGINE=InnoDB;
|
|
+--connect (prevent_purge,localhost,root)
|
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
+
|
+--connection default
|
INSERT INTO t1 VALUES(1,2),(3,4);
|
UPDATE t1 SET b=-3 WHERE a=3;
|
|
+--connect (con1,localhost,root)
|
+BEGIN;
|
+UPDATE t1 SET b=4 WHERE a=3;
|
+--disconnect prevent_purge
|
+
|
+--connection default
|
# Initiate a full purge, which should reset all DB_TRX_ID.
|
--source include/wait_all_purged.inc
|
+--disconnect con1
|
+--source include/wait_all_purged.inc
|
|
FLUSH TABLE t1 FOR EXPORT;
|
# The following is based on innodb.table_flags: |
If the old transaction is purgeable, then we should write DB_TRX_ID=0 to the undo log record, so that in case our transaction is rolled back, the history will be reset at rollback.
With the above modification to the test, there will be an unwanted result difference:
@@ -19,8 +29,8 @@
|
DB_ROLL_PTR=0x80000000000000,
|
b=0x80000002)
|
header=0x000018090074 (a=0x80000003,
|
- DB_TRX_ID=0x000000000000,
|
- DB_ROLL_PTR=0x80000000000000,
|
+ DB_TRX_ID=0x000000000026,
|
+ DB_ROLL_PTR=0x04000001370317,
|
b=0x7ffffffd)
|
header=0x030008030000 (a=0x73757072656d756d00)
|
UNLOCK TABLES; |
In this report, there used to be a different test demonstrating a bug that affects all InnoDB versions since MySQL 3.23.49:
MDEV-13603 innodb_fast_shutdown=0 may fail to purge all history
Attachments
Issue Links
- causes
-
MDEV-16143 Assertion failure in rec_offs_get_n_alloc() due to row_trx_id_offset()
- Closed
- is blocked by
-
MDEV-12288 Reset DB_TRX_ID when the history is removed, to speed up MVCC
- Closed
-
MDEV-13536 DB_TRX_ID is not actually being reset when the history is removed
- Closed
- relates to
-
MDEV-13603 innodb_fast_shutdown=0 may fail to purge all history
- Closed
-
MDEV-13654 Various crashes due to DB_TRX_ID mismatch in table-rebuilding ALTER TABLE…LOCK=NONE
- Closed
-
MDEV-18706 ER_LOCK_DEADLOCK on concurrent read and insert into already locked gap
- In Review