[MDEV-2672] LP:640419 - Wrong result with sort_union/index_merge in maria-5.1 and a large table Created: 2010-09-16 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Philip Stoev (Inactive) | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query: SELECT * FROM `table100000_innodb_int_autoinc` WHERE ( ( `col_bigint_key` >= 1 ) OR `pk` BETWEEN 8 AND 40 + 64 ) OR ( `pk` BETWEEN 1 AND 1 + 185 AND `col_bigint_key` IS NULL ) Returns a different number of rows when executed with an index_merge/sort_union strategy. |
| Comments |
| Comment by Philip Stoev (Inactive) [ 2010-09-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1-wl24 and a large table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The test case appears to require at least 10K rows to work. Further simplification was not possible. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1 and a large table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1 and a large table perl mysql-test-run.pl --record --no-check-testcases bug640419.test and then manually examine the .result file to see the different query results. If you want the test case to classically fail if the bug is present, remove the "- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1 and a large table SELECT COUNT SELECT COUNT SELECT COUNT Explain plans: EXPLAIN SELECT * FROM `table100000_innodb_int_autoinc` FORCE KEY ( PRIMARY , `col_smallint_key` , `col_bigint_key` , `col_varchar_10_key` , `col_varchar_64_key` ) WHERE ( ( `col_bigint_key` >= 1 ) OR `pk` BETWEEN 8 AND 40 + 64 ) OR ( `pk` BETWEEN 1 AND 1 + 185 AND `col_bigint_key` IS NULL ); id select_type table type possible_keys key key_len ref rows Extra EXPLAIN SELECT * FROM `table100000_innodb_int_autoinc` IGNORE KEY ( PRIMARY , `col_smallint_key` , `col_bigint_key` , `col_varchar_10_key` , `col_varchar_64_key` ) WHERE ( ( `col_bigint_key` >= 1 ) OR `pk` BETWEEN 8 AND 40 + 64 ) OR ( `pk` BETWEEN 1 AND 1 + 185 AND `col_bigint_key` IS NULL ); EXPLAIN SELECT * FROM `table100000_innodb_int_autoinc` WHERE ( ( `col_bigint_key` >= 1 ) OR `pk` BETWEEN 8 AND 40 + 64 ) OR ( `pk` BETWEEN 1 AND 1 + 185 AND `col_bigint_key` IS NULL ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1 and a large table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Test case with a smaller table, requiring a small sort_buffer_size. Also, only FORCE and IGNORE KEY queries are used to avoid any ambiguity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1 and a large table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Diff between the FORCE KEY and IGNORE KEY result sets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1 and a large table 0. Take a 64-bit machine 1. Branch a fresh tree bzr branch lp:maria/5.1 maria-5.1-bug637962 2. Clear ccache ccache -C 3. Compile ./BUILD/compile-pentium-debug-max 4. Run. perl mysql-test-run.pl --record --no-check-testcases t/bug640419-2.test If successfull, MTR will report mysqltest: At line 1462: "Bug is repeatable" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2010-09-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1 and a large table CREATE TABLE t1 ( INSERT INTO t1(a,b) VALUES SET SESSION sort_buffer_size = 1024*36; EXPLAIN EXPLAIN Running this test case one can see that the execution with index merge returns a wrong result: MariaDB [test]> EXPLAIN
---
--- MariaDB [test]> SELECT COUNT
----------
---------- MariaDB [test]> EXPLAIN
---
--- MariaDB [test]> SELECT COUNT
----------
---------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2010-09-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with sort_union/index_merge in maria-5.1 and a large table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Launchpad bug id: 640419 |