[MDEV-30944] Range_rowid_filter::fill() leaves file->keyread at MAX_KEY Created: 2023-03-28 Updated: 2023-06-07 Resolved: 2023-06-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 11.0 |
| Fix Version/s: | 11.0.3, 11.1.2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Alice Sherepa | Assignee: | Michael Widenius |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Repeatable on 11.0, not on 10.4-10.11, with Myisam, not Innodb
also 11.0/src/sql/sql_select.cc:24131: int join_read_last(JOIN_TAB*): Assertion `table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index' |
| Comments |
| Comment by Rex Johnston [ 2023-06-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
assert failure in sub_select() something is altering keyread when the table is MyISAM, not InnoDB The optimizer, when testing for rowid_filters
decides that when using MyISAM, a rowid filter is faster than not using one. Filling the rowid filter object container sub_select()/build_range_rowid_filter()
ends up calling Range_rowid_filter::fill()
ha_end_keyread() sets file->keyread to MAX_KEY back up the stack, in sub_select(), a subsequent call
executes the assert
each element of which, in this case will be false. The obvious solution is reset the keyread variable back to it's state as at the start of the Range_rowid_filter::fill() routine, like other similar table/file variables. rowid filters are evaluated in Range_rowid_filter_cost_info::apply_filter()
Any scenario where new_cost < org_cost, will lead to a rowid filter being constructed and used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rex Johnston [ 2023-06-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Following your commit from 2019-02-03. Is this OK? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rex Johnston [ 2023-06-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
output from
for 11.0
for 10.11
we can clearly see the new cost based optimization in action. These news costs introduced in commit d9d0e78039fd3fbeac814edd27fabfe3e4450bc5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2023-06-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I don't think the current patch with saving and restoring keyread will work. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2023-06-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This test case exposed 2 different bugs:
|