[MDEV-26333] Resullt of SELECT from partitioned Spider table depends on the partition targeted by the previous SELECT Created: 2021-08-10 Updated: 2021-11-23 Resolved: 2021-10-18 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Partitioning, Storage Engine - Spider |
| Affects Version/s: | 10.3.29, 10.3.31 |
| Fix Version/s: | 10.3.32 |
| Type: | Bug | Priority: | Major |
| Reporter: | Valerii Kravchuk | Assignee: | Nayuta Yanagisawa (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | not-10.2, not-10.4, not-10.5, not-10.6 | ||
| Issue Links: |
|
||||||||
| Description |
|
Consider the following primitive test case executed on an instance with Spider engine loaded and spider_same_server_link=1, and databases test, db1, db2 and db3 created:
As you can see, the result of: select * from ts; depends on what specific partition was targeted by the previous SELECT. Something is stored somewhere and not cleaned up properly. |
| Comments |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-08-10 ] | ||||||||||||||||||||||||||||||||||
|
I confirmed that the bug is reproducible on 10.3 HEAD (7f26499), but not on 10.2 HEAD. | ||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-08-10 ] | ||||||||||||||||||||||||||||||||||
|
select * from ts is a multi-partition search, so it should not use the group by the handler. However, after select * from ts where id = 1, the multi-partition search uses the group by handler.
| ||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-08-10 ] | ||||||||||||||||||||||||||||||||||
|
I'm a bit surprised but the bug is not reproducible in 10.4.20. 10.5.11, 10.6.3. | ||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-08-10 ] | ||||||||||||||||||||||||||||||||||
|
I did GDB debugging on spider_create_group_by_handler() (10.3 HEAD). The problem is that the second SELECT without WHERE clause does not return NULL here. https://github.com/MariaDB/server/blob/mariadb-10.3.31/storage/spider/spd_group_by_handler.cc#L1662-L1672 | ||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-08-10 ] | ||||||||||||||||||||||||||||||||||
|
The above is because partition->get_part_spec() returns {start_part = 0, end_part = 0} for the second SELECT without WHERE clause. The member function is just to returns &m_part_spec. So, the content of m_part_spec seems to wrong. | ||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-08-10 ] | ||||||||||||||||||||||||||||||||||
|
I am convinced that the reason why the bug is not reproducible on 10.4 or later is the following commit is merged in 10.4 or later: https://github.com/MariaDB/server/commit/9d6b601e797dd8333340dadaefae09ebafc787db | ||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-08-10 ] | ||||||||||||||||||||||||||||||||||
|
I cherry-picked the fix for | ||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2021-10-16 ] | ||||||||||||||||||||||||||||||||||
|
ok to push |