[MDEV-12636] SELECT UNION writes garbage tail of VARCHAR column into internal temporary table Created: 2017-04-29 Updated: 2018-06-11 Resolved: 2018-06-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer, Storage Engine - Aria, Tests |
| Affects Version/s: | 10.1, 10.2 |
| Fix Version/s: | 10.1.33, 10.2.15 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Sprint: | 10.1.24, 10.2.10, 10.2.11 | ||||||||||||
| Description |
|
Might be related to MDEV-5518 / https://bugs.mysql.com/bug.php?id=73819
|
| Comments |
| Comment by Marko Mäkelä [ 2017-05-05 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This could have a common root cause with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-08-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Reproducible locally (Jessie 8.8 64-bit, valgrind-3.12.0.SVN, gcc (Debian 4.9.2-10) 4.9.2) on the current 10.1 tree:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-08-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
With vgdb, I got the following stack trace with parameter values:
After killing the server at this spot, I will get:
With the attached patch, the test completes without any Valgrind or server error whatsoever (not even on shutdown):
I suppose that also the result to the client would be written to write() and instrumented by Valgrind, so InnoDB cannot be the culprit here. The problem seems to be in the UNION execution instead. Whoever fixes this should also uncomment the following statement in the test:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Reduced test case:
Relevant configuration: cmake -DWITH_VALGRIND=ON -DWITH_ASAN=OFF -DCMAKE_BUILD_TYPE=Debug With MyISAM instead of InnoDB, it does not fail, but that could be because MyISAM is not calling VALGRIND_MAKE_MEM_UNDEFINED. The problem seems to be the UNION. A plain SELECT with or without the ORDER BY will execute just fine. It would seem to me that the issue is that the uninitialized tail of VARCHAR columns is being written to a temporary table. With CHAR(10) instead of VARCHAR(10), the test passes just fine. Please refer to Bug#12835650 VARCHAR maximum length performance impact. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-09-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
5.5 & 10.0 has no features used in the test suite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Does the test case really require FULLTEXT INDEX? Note that 10.0 should support FULLTEXT INDEX for InnoDB tables. 5.5 does not, but the problem should be repeatable there with a different type of query if you define UNIV_DEBUG_VALGRIND inside InnoDB.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-10-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It is not repeatable on 5.5 without FULLTEXT INDEX. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-10-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
in 10.0 FT expressions prohibited in last "union branch" (whatever does mean in the comment) so it is also not repeatable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If remove "binary mode" it return error that can not find fulltext index and it looks correct, why it do not need index in binary mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
it appeared that boolean mode allow absence of index. internal temporary table table is aria, returned value of match is the same independent of original type of the table, but bug reproduceble only with innodb as t1 table. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It is 2 SELECTs with number 3, probably again problem of reset counter of SELECTs because of the error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2018-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The problem is fixed. the fact that bisect can't find normally the commit which fixed it it came form merge. Also query in one of the test proposed here start return incorrect usage of FT and also the fact that it was not repeatable without FT and binary patch in particular makes me think that problem was there. So I will just uncomment commented out test in fulltext_misc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2018-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
OK, bisect was done incorrectly. Fix Innodb ASAN error on init Backport 7c03edf2fe66855a8ce8f2575c3aaf66af975377 from xtradb to innodb |