[MDEV-30540] Wrong result with IN list length reaching IN_PREDICATE_CONVERSION_THRESHOLD Created: 2023-02-01 Updated: 2023-04-07 Resolved: 2023-02-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | N/A |
| Fix Version/s: | 11.0.0 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
I could only reproduce it on bb-11.0 so far.
The second one is of course the correct result. Plan with the wrong result:
Reproducible with MyISAM, InnoDB, Aria. |
| Comments |
| Comment by Sergei Petrunia [ 2023-02-03 ] | |||||||||||||||||||||||||||||
|
The scenario which causes the bug is as follows:
| |||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2023-02-03 ] | |||||||||||||||||||||||||||||
|
Stack trace of the location where all indexes are removed:
| |||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2023-02-06 ] | |||||||||||||||||||||||||||||
|
Developed a fix for this, but I get a failure in another test. It shows that the fix exposes another bug which is not easy to fix. Pushed a commit which temporarily disables the Derived tables and union can now create distinct keys feature of bb-11.0 tree. It makes this bug go away.
| |||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2023-02-09 ] | |||||||||||||||||||||||||||||
|
The patch which makes derived_with_keys optimization not to remove unique keys: fix-unique-attempt.diff It causes this test failure:
| |||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2023-02-10 ] | |||||||||||||||||||||||||||||
|
Worked with Petruna to fix this one. The problem was the mysql_derived_prepare() did not correctly set Fixed by separating checking for distinct for queries with and without UNION. | |||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2023-03-01 ] | |||||||||||||||||||||||||||||
|
The patch was not pushed at once as buildbot discovered a crash on Windows after the patch was pushed. |