-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-36281 DML aborts during online virtual index #3894
base: 10.6
Are you sure you want to change the base?
Conversation
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. The fix looks reasonable to me, but I would like to see a little more detailed test coverage.
set DEBUG_SYNC="now SIGNAL dml_finish"; | ||
|
||
connection default; | ||
reap; | ||
DROP TABLE t1; | ||
disconnect con1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disconnect con1
could be executed before switching to connection default
.
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_finish'; | ||
send ALTER TABLE t1 ADD INDEX(f5, f2, f4); | ||
|
||
connection con1; | ||
set DEBUG_SYNC="now WAIT_FOR dml_start"; | ||
UPDATE t1 SET f3= f3 + 1; | ||
set DEBUG_SYNC="now SIGNAL dml_finish"; | ||
|
||
connection default; | ||
reap; | ||
DROP TABLE t1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to double check that this is actually testing a scenario where the value of an indexed virtual column f4 AS (f3)
in the being-created index on (f5
,f2
,f4
) is changing. Could we add another index, say, ADD INDEX(f3,f5)
where only the value of a non-virtual column is changing? And execute both CHECK TABLE t1 EXTENDED
and a number of SELECT
with FORCE INDEX
to display the contents of each created virtual index?
Description
Reason:
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:
How can this PR be tested?
./mtr innodb.innodb-index-online
Basing the PR against the correct MariaDB version
main
branch.PR quality check