[MDEV-5512] Wrong result (WHERE clause ignored) with multiple clauses using Percona-XtraDB engine Created: 2014-01-08 Updated: 2014-01-26 Resolved: 2014-01-24 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.3.12, 5.5.34, 10.0.7 |
| Fix Version/s: | 5.5.35, 10.0.8, 5.3.13 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Scott Wylie | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Centos 6 X64 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
A SELECT statement with multiple WHERE clauses and ASC LIMIT returns all rows up to the limit, the WHERE clauses are ignored. Commenting out one or more of the WHERE clauses causes the query to return the correct results. Query: WHERE (`applications`.`configuration_scope_id` = 2) ORDER BY `applications`.`id` See attached .zip which contains a .sql that can be used to create the table. The problem only occurs when using the Percona-XtraDB, it does not occure when using INNODB. |
| Comments |
| Comment by Elena Stepanova [ 2014-01-08 ] |
|
Thanks for the report. The bug looks very similar to |
| Comment by Sergei Petrunia [ 2014-01-09 ] |
|
The EXPLAIN is the same regardless of ICP settings: id: 1 Indexes: The query: Which means: |
| Comment by Sergei Petrunia [ 2014-01-09 ] |
|
Optimization goes as follows: make_join_readinfo JOIN::exec |
| Comment by Sergei Petrunia [ 2014-01-09 ] |
|
Just wondering about MySQL... I've checked mysql-5.6.
Debugging the second point further:
jorgen.loland@oracle.com-20121207082040-scw8kl51svt5geoc which causes the optimizer to pick index=12 before ICP is applied. I am not sure if it is possible to get 5.6 to pick a plan with range+ICP but Another fix in 5.6 which might be related: |
| Comment by Sergei Petrunia [ 2014-01-09 ] |
|
Getting back to debug MariaDB 5.5... .. test_if_skip_sort_order() has this code at the end: skipped_filesort: it is run ... The problem is that tab->cond is not set to pre_idx_push_select_cond is set by this piece of code above (still in else if (tab->type != JT_ALL) execution doesn't enter this branch because tab->type == JT_ALL (we've had a It looks like "tab->type != JT_ALL" is incorrect, and it should be changed to Looked through bzr history.. the "tab->type != JT_ALL" was there at least since |
| Comment by Sergei Petrunia [ 2014-01-24 ] |
|
ScottWylie, thanks for reporting this bug, and for the testcase. |
| Comment by Elena Stepanova [ 2014-01-26 ] |
|
The commit comment refers to |