[MDEV-6838] Using too big key for internal temp tables Created: 2014-10-05 Updated: 2015-03-06 Resolved: 2015-03-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery, Optimizer |
| Affects Version/s: | 5.5.39, 10.0.14 |
| Fix Version/s: | 5.5.43 |
| Type: | Bug | Priority: | Major |
| Reporter: | Patryk Pomykalski | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
Due to differences in: |
| Comments |
| Comment by Sergei Petrunia [ 2015-02-05 ] | |||||||||||||||
|
If I replace 995 with 998 in the example, the error goes away:
| |||||||||||||||
| Comment by Sergei Petrunia [ 2015-02-05 ] | |||||||||||||||
|
with CHAR(998), in create_internal_tmp_table() we have:
with CHAR(995), in create_internal_tmp_table() we have:
The suspect is this line:
why do we have >= in
| |||||||||||||||
| Comment by Sergei Petrunia [ 2015-02-05 ] | |||||||||||||||
|
So, this basically confirms pomyk's initial suggestion that instead of >= we should have > here. | |||||||||||||||
| Comment by Vicențiu Ciorbaru [ 2015-02-16 ] | |||||||||||||||
|
This test case continues to fail despite the changes discussed previously:
The test case with the VARCHAR length set at 996 causes the check
to fail, with the key_length == 1001. For 998 this passes, as the key length is set to 5. | |||||||||||||||
| Comment by Vicențiu Ciorbaru [ 2015-02-16 ] | |||||||||||||||
|
Discovered thus far: After it gets converted, the key_length remains the same, but the max_key_length supported by the ARIA engine is below the threshold.
| |||||||||||||||
| Comment by Sergei Petrunia [ 2015-02-16 ] | |||||||||||||||
|
Debugging a case with VARCHAR(997). The sequence of calls is as follows: 1. create_tmp_table ( do_not_open=true ...) 2. TABLE::check_tmp_key() 3. TABLE::add_tmp_key() The calculations at #2 make sense. It takes 997 as char length, then it adds 1 byte for NULL-flag, then it adds two bytes for length. Calculations in #3 do not make sense:
| |||||||||||||||
| Comment by Sergei Petrunia [ 2015-02-16 ] | |||||||||||||||
|
Looking at field.h
but TABLE::create_key_part_by_field does this:
apparently TABLE::create_key_part_by_field adds the length twice. | |||||||||||||||
| Comment by Sergei Petrunia [ 2015-03-04 ] | |||||||||||||||
|
Ok to push. I think, the patch is sufficiently simple so that approval of one reviewer is sufficient. | |||||||||||||||
| Comment by Vicențiu Ciorbaru [ 2015-03-04 ] | |||||||||||||||
|
Fixed with commit: |