| Bug #106163 | Inplace Add index with lock=exclusive doesn't generate MLOG_ADD_INDEX redo | ||
|---|---|---|---|
| Submitted: | 14 Jan 2022 5:36 | Modified: | 14 Jan 2022 5:56 |
| Reporter: | Rahul Malik | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
| Version: | 8.0.27 5.7.36 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution | ||
[14 Jan 2022 5:56]
MySQL Verification Team
Hello Rahul, Thank you for the report and feedback. regards, Umesh
[18 Feb 2022 4:21]
Rahul Malik
8.0 fix (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: 8.0-bug106163.patch (application/octet-stream, text), 0 bytes.
[18 Feb 2022 5:00]
Rahul Malik
5.7 patch (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: 5.7-bug106163.patch (application/octet-stream, text), 3.40 KiB.
[18 Feb 2022 5:00]
Rahul Malik
8.0 patch (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: 8.0-bug106163.patch (application/octet-stream, text), 4.56 KiB.
[18 Feb 2022 5:53]
MySQL Verification Team
Thank you, Rahul for the contribution. regards, Umesh

Description: Inplace index build using bulk_btr are not redo logged. So server adds MLOG_ADD_INDEX redo for such case. It is very important for backup tool/crash recovery to know if any transaction happened without redo logging. When lock=exclusive and algrotithm=inplace is used. Server is not calling Builder::write_redo to write MLOG_ADD_INDEX redo. How to repeat: CREATE TABLE t1(t1_c1 serial,t1_c2 int); INSERT into t1(t1_c2) VALUES(1),(4); ALTER TABLE t1 ADD INDEX t1_i(t1_c2) , LOCK=EXCLUSIVE, ALGORITHM=INPLACE; whereas it works fine with LOCK=Default. Suggested fix: Call finalize() outside of block given below because index is build using btr_blk. So server should be writing MLOG_ADD_INDEX entry irrespective of m_ctx.m_online value. if (get_error() != DB_SUCCESS || !m_ctx.m_online) { /* Do not apply any online log. */ } else if (m_ctx.m_old_table != m_ctx.m_new_table) { ut_a(!m_index->online_log); ut_a(m_index->online_status == ONLINE_INDEX_COMPLETE); auto observer = m_ctx.m_trx->flush_observer; observer->flush(); } else { err = finalize(); if (err != DB_SUCCESS) { set_error(err); } }