[MDEV-19266] Crash in EITS code when enabling 128 indexes Created: 2019-04-17 Updated: 2019-04-18 Resolved: 2019-04-18 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.4 |
| Fix Version/s: | 10.4.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Got this from Wlad: range_vs_index_merge test fails in 128-index build. Can be reproduced on bb-10.4-wlad with
The stack trace:
The crash happens because param->real_keynr[n] has garbage values for all values except 0. |
| Comments |
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
EITS code works as follows:
However, calculate_cond_selectivity_for_table only sets the first element in param.real_keynr:
| |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
The stack trace shows it is trying to construct an index merge plan. Considering that the EITS estimator is only able to use individual range scans, does this make any sense? But this question is orthogonal to the issue of param->real_keynr[i] not being set. It is suspicious that they need real_keynr value, EITS estimator uses pseudo indexes... | |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
Attempt at fix #1 that I have provided to Wlad:
| |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
.... and this patch is probably incorrect. The assert happens here:
with the above patch, param->real_keynr[key_no] is "the number of column that we do EITS estimation for". Got to check what is with_impossible_ranges. | |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
with_impossible_ranges was added by:
| |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
An updated fix:
| |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
The whole with_impossible_ranges code looks odd to me. So one can add something like " AND (t.key>10 AND t.key < 5)" to a query, and that would affect the query plan somehow? | |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
http://lists.askmonty.org/pipermail/commits/2019-April/013649.html | |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-17 ] | |||||||||||||||||
|
Igor, please review | |||||||||||||||||
| Comment by Igor Babaev [ 2019-04-17 ] | |||||||||||||||||
|
Ok to push into 10.4 | |||||||||||||||||
| Comment by Igor Babaev [ 2019-04-17 ] | |||||||||||||||||
|
Sergei, Wlad | |||||||||||||||||
| Comment by Vladislav Vaintroub [ 2019-04-17 ] | |||||||||||||||||
|
I only tried with 10.4, I do not have problems with 10.2 | |||||||||||||||||
| Comment by Sergei Petrunia [ 2019-04-18 ] | |||||||||||||||||
|
I've set affects-versions to include 10.2 and 10.3 based on the first variant of the fix (which was in EITS code so I assumed earlier versions would be affected as well). |