[MDEV-26111] Spider handle ">=" as "=" in some cases Created: 2021-07-08 Updated: 2023-05-23 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Spider |
| Affects Version/s: | 10.2 |
| Fix Version/s: | 10.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Nayuta Yanagisawa (Inactive) | Assignee: | Yuchen Pei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Through the investigation for How to reproduce:
The query, executed on the data node, corresponding to one executed on the Spider node is the following:
|
| Comments |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-26 ] | ||||||||||||||||||
|
I cannot reproduce the bug on 10.3 HEAD (f52d39369a6e3f1a9ce89189180d142e54299862) with the test case attached to the issue description. Of course, there is the possibility that we could reproduce a similar bug with much more complex queries.
| ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-26 ] | ||||||||||||||||||
|
Again, I think that the above does not mean that there is no logic error in 10.3 or beyond. This is speculation, but I guess that the errors are just not showing up because of changes of the execution paths. | ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-28 ] | ||||||||||||||||||
|
The issue looks somewhat similar to | ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-28 ] | ||||||||||||||||||
|
A possible fix would be the following. All the tests on 10.2 pass with the fix, but I will look into it further to ensure the fix doesn't affect the other part of the code.
| ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-28 ] | ||||||||||||||||||
|
All the tests on 10.6 HEAD also pass with the above fix. | ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-28 ] | ||||||||||||||||||
|
use_both == false (i.e., end_key == NULL) doesn't implies the original search condition is an equality. In fact, if we specifies the search condition B.c > 0 AND B.b >= 1, then we get end_key == NULL. It seems to be wrong to set key_eq = TRUE when use_both && tgt_key_part_map > 1
| ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-28 ] | ||||||||||||||||||
|
By the above fix, we get a correct query for a data node:
| ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-28 ] | ||||||||||||||||||
|
serg Please review: https://github.com/MariaDB/server/commit/ea162a60324481c16aeaed838093abddc5a22061 | ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-28 ] | ||||||||||||||||||
|
serg I edited the commit message. Please review the following rather than the above: https://github.com/MariaDB/server/commit/3efc826bff5ad40869da5fb6367b8b250182ad04 | ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-08-13 ] | ||||||||||||||||||
|
serg I may miss something. Let me withdraw the patch. | ||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-09-01 ] | ||||||||||||||||||
|
The bug doesn't reproduce on 10.3 because it skips the part of spider_db_append_key_where_internal() which prints the wrong WHERE condition by jumping to the end label.
|