[MDEV-10397] Server crashes in key_copy with join_cache_level > 2 and join on BIT fields Created: 2016-07-19 Updated: 2017-11-30 Resolved: 2017-11-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 5.5, 10.0, 10.1 |
| Fix Version/s: | 5.5.59, 10.0.34, 10.1.30 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Sprint: | 10.1.29 | ||||||||
| Description |
|
|
| Comments |
| Comment by Varun Gupta (Inactive) [ 2017-11-03 ] | |||||||||
|
Some investigation results In the function TABLE::create_key_part_by_field
So for the above select query as the field b1 and b2 are defined NOT NULL due to which field->null_ptr is NULL
This definitely does not look correct, we need to only do the above ptr difference only when field->null_ptr is defined | |||||||||
| Comment by Varun Gupta (Inactive) [ 2017-11-03 ] | |||||||||
|
In function key_copy
So due to the incorrect pointer difference pointed above we are having the server crash in the key_copy function | |||||||||
| Comment by Sergei Petrunia [ 2017-11-06 ] | |||||||||
|
(for the record, I needed to use MyISAM to reproduce). Confirm the findings. | |||||||||
| Comment by Sergei Petrunia [ 2017-11-06 ] | |||||||||
|
The crash goes away if I set key_part_info->null_bit to 0 in TABLE::create_key_part_by_field. But is this the right solution? If one looks at the code in TABLE::create_key_part_by_field below, one can see:
This branch is not taken. The use of real_maybe_null implies that TABLE::create_key_part_by_field should use field NULL-ability from the underlying table, ignoring the NULL-ability that comes from outer joins. | |||||||||
| Comment by Igor Babaev [ 2017-11-06 ] | |||||||||
|
I wonder whether the type of the fields (BIT) is essential here. | |||||||||
| Comment by Sergei Petrunia [ 2017-11-08 ] | |||||||||
|
igor yes, it seems to be. I've tried debugging with both original table definition and this one:
then for BIT field , immediately after return from open_table we have:
while for TINYINT it is
. I am not sure which one is right:
| |||||||||
| Comment by Sergei Petrunia [ 2017-11-11 ] | |||||||||
|
varun, when you're back please check where does this null_bit difference come from. Is it intentional, is there any handling of this in other code? | |||||||||
| Comment by Varun Gupta (Inactive) [ 2017-11-28 ] | |||||||||
|
In the function make_field we have this piece of code for BIT field
So this is where we get the null_bit set for BIT fields | |||||||||
| Comment by Sergei Petrunia [ 2017-11-30 ] | |||||||||
|
Should check the affected .result files and ok to push after that. |