1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36281 DML aborts during online virtual index

Reason:
=======
- InnoDB DML commit aborts the server when InnoDB does online
virtual index. During online DDL, concurrent DML commit
operation does read the undo log record and their related
current version of the clustered index record. Based on the
operation, InnoDB do build the old tuple and new tuple for
the table. If the concurrent online index can be affected
by the operation, InnoDB does build the entry
for the index and log the operation.

Problematic case is update operation, InnoDB does build the
update vector. But while building the old row, InnoDB fails
to fill the non-affected virtual column. This lead to
server abort while build the entry for index.

Fix:
===
- First, fill the virtual column entries for the new row.
Duplicate the old row based on new row and change only the
affected fields in old row based on the update vector.
This commit is contained in:
Thirunarayanan Balathandayuthapani
2025-03-25 20:03:14 +05:30
committed by Sergei Golubchik
parent a390aaaf23
commit 1f4a901576
3 changed files with 56 additions and 10 deletions

View File

@@ -534,7 +534,6 @@ INSERT INTO t1 VALUES(1,1);
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL inserted';
connection con1;
disconnect con1;
connection default;
SELECT * FROM t1;
a b
@@ -543,6 +542,31 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
#
# MDEV-36281 DML aborts during online virtual index
#
CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 INT NOT NULL,
f3 INT NOT NULL, f4 INT AS (f3) VIRTUAL,
f5 INT AS (f1) VIRTUAL, INDEX(f4))ENGINE=InnoDB;
INSERT INTO t1(f1, f2, f3) VALUES(1, 2, 3);
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_finish';
ALTER TABLE t1 ADD INDEX v1(f5, f2, f4), ADD INDEX v2(f3, f5);
connection con1;
set DEBUG_SYNC="now WAIT_FOR dml_start";
UPDATE t1 SET f3= f3 + 1;
set DEBUG_SYNC="now SIGNAL dml_finish";
disconnect con1;
connection default;
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT f5, f2, f4 FROM t1 USE INDEX(v1);
f5 f2 f4
1 2 4
SELECT f3, f5 FROM t1 USE INDEX(v2);
f3 f5
4 1
DROP TABLE t1;
SET DEBUG_SYNC = 'RESET';
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
SET GLOBAL innodb_monitor_enable = default;