[MDEV-33314] Crash inside calculate_cond_selectivity_for_table() with many columns Created: 2024-01-25 Updated: 2024-02-07 Resolved: 2024-02-03 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.6 |
| Fix Version/s: | 10.5.25, 10.6.18, 10.11.8, 11.0.6, 11.1.5, 11.2.4, 11.3.3, 11.4.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Description |
|
I will post a reduced testcase once I have it. The symptom of the bug is
The stack trace:
In the testcase I'm trying, calculate_cond_selectivity_for_table() is trying to get estimates for 168 columns:
the range optimizer can handle at most 64 indexes. |
| Comments |
| Comment by Sergei Petrunia [ 2024-01-26 ] | |||||||
|
bb-10.6- | |||||||
| Comment by Sergei Petrunia [ 2024-01-27 ] | |||||||
|
ralf.gebhardt, the problem and the fix will be still valid for the ES. There is only one thing: I might need to adjust the patch's testcase to use > 128 indexes (currently it uses 100). The rest of the patch is valid. | |||||||
| Comment by Michael Widenius [ 2024-01-28 ] | |||||||
|
@spetruna, how do you plan to choose the fields that we should create a pseudo index for? Another option would be to change SEL_TREE::keys_map to have an explicit key map allocated in get_mm_parts() | |||||||
| Comment by Michael Widenius [ 2024-01-28 ] | |||||||
|
Review comments: In the test case, you should create MAX_INDEXES + 1 fields and conditions. To do that, please add system variable, MAX_INDEXES. This can be genrally
You can remove the rows variable and replace it with rows= records_in_column_ranges(¶m, idx, key); I have one open question:
For pseudo trees, do we ever try to merge or combine the bitmaps? I spent some time looking at the code and it is probably safe as we never | |||||||
| Comment by Sergei Petrunia [ 2024-01-29 ] | |||||||
|
igor, look: create_key_parts_for_pseudo_indexes() uses this piece of code to check whether to create pseudo indexes for columns:
So are you suggesting that outside of create_key_parts_for_pseudo_indexes there should be identical code that walks through the columns, checks "if_eits_usable" and collects a bitmap of first 64 columns, then calls create_key_parts_for_pseudo_indexes(). Since you request not to touch create_key_parts_for_pseudo_indexes(), it will check "if_eits_usable" for each passed column again. Is that what you would prefer to see implemented? Please clarify. | |||||||
| Comment by Sergei Petrunia [ 2024-01-30 ] | |||||||
|
Slo we do need to change create_key_parts_for_pseudo_indexes after all? Ok let me try making a patch. | |||||||
| Comment by Sergei Petrunia [ 2024-02-01 ] | |||||||
|
igor could you please review the latest patch: https://github.com/MariaDB/server/commit/2949128be1ffd7c340676618b83145f4f3f3929b | |||||||
| Comment by Igor Babaev [ 2024-02-02 ] | |||||||
|
I don't see any problems with the patch. Yet as it's a crashing bug the patch should be applied to 10.5 as well. |