Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-33533: Crash at execution of DELETE when trying to use rowid filter
(Based on original patch by Oleksandr Byelkin) Multi-table DELETE can execute via "buffered" mode: at phase #1 it collects rowids of rows to be deleted, then at phase #2 in multi_delete::do_deletes() it calls handler->rnd_pos() to read rows to be deleted and deletes them. The problem occurred when phase #1 used Rowid Filter on the table that phase #2 would be deleting from. In InnoDB, h->rnd_init(scan=false) and h->rnd_pos() is an index scan over PK under the hood. So, at phase #2 ha_innobase::rnd_init() would try to use the rowid filter an assertion inside ha_innobase::rnd_init(). Note that multi-table UPDATE works similarly but was not affected, because patch for MDEV-7487 added code to disable rowid filter for phase #2 in multi_update::do_updates(). This patch changes the approach: - It makes InnoDB not use Rowid Filter in rnd_pos() scans: it is disabled in ha_innobase::rnd_init() and enabled back in ha_innobase::rnd_end(). - multi_update::do_updates() no longer disables rowid filter for phase#2 as it is no longer necessary.
- Loading branch information
2a3a1ba
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.
Hi Sergei,
Thanks for solving the issue which could be a critical problem for user. I understand what we are fixing here but I could not agree with the design and adding storage engine specific code to enable/disable row ID filtering. It should be driven by the layer above.
A. About the design. I think we should clearly state the design objectives.
B. Version to be fixed: The issue should be there 10.5 too. The only issue could be generating the right plan. We should fix it in all versions otherwise it would stay like a hidden bomb fired in customer place with a very complex scenario.
Regards,
Deb
2a3a1ba
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 am done with the review and the patch looks functionally correct.
The expectation from SE looks like an exception and I would love to see this dependency eliminated in future. More comments in MDEV.