[MDEV-4050] apply a patch for MySQL bug#12694872 Created: 2013-01-15  Updated: 2014-11-26

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: N/A
Fix Version/s: 5.5

Type: Bug Priority: Major
Reporter: Sergei Golubchik Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File 12694872.diff    

 Description   

MySQL 5.5.29 has a patch backported from MySQL 5.6, that supposedly fixes a bug.

The test case for this bugfix is wrong, it doesn't exercise the changed code. We need to fix the test case to see if there's a genuine bug, and apply the MySQL fix, if it's good.

The patch is attached.



 Comments   
Comment by Sergei Petrunia [ 2014-02-10 ]

"Changeset in 5.5 with the test case" is actually in 5.6

Comment by Sergei Petrunia [ 2014-02-10 ]

If I take the cset "tor.didriksen@oracle.com-20110825105434-ll28zinu0nhazt3z", undo the changes in sql_select.cc (so that changes in other files remain, we get the added asserts and new testcases), and after that run the testsuite, I get:

mysqld: /home/psergey/dev2/mysql-5.6-r3404/sql/uniques.cc:587: bool Unique::get(TABLE*): Assertion `table->sort.record_pointers == __null' failed.

Comment by Sergei Petrunia [ 2014-02-10 ]

If I

  • take the fix for mysql-5.5
  • remove all changes except the assert statements
  • add a testcase from the fix for 5.6
    I get assertion failures
Comment by Sergei Petrunia [ 2014-02-11 ]

There is another bugfix that is related to MySQL BUG#12694872:

Bug#13340270: assertion table->sort.record_pointers == __null

bug#12694872 fixed a memory leak in Unique::get(), but did not expect
Unique::get() to be called twice before the end of the query, where
buffers are freed.

Comment by Elena Stepanova [ 2014-11-26 ]

For a note, we have a 5.3 bug apparently with a similar valgrind warning: MDEV-5623.
The test case there is for Aria, but it can be tweaked to be valid for MyISAM as well, e.g.

SET optimizer_switch = 'index_merge=on,index_merge_sort_union=on,derived_merge=on,in_to_exists=on';
 
 
CREATE TABLE t1 (a INT, b INT, c VARCHAR(1), INDEX(a), INDEX(c)) ENGINE=MyISAM;
INSERT INTO t1 VALUES 
(5,6,'z'),(2,6,'c'),(0,8,'a'),(1,2,'q'),(8,6,'y'),
(1,8,'y'),(1,3,'r'),(9,3,'v'),(1,9,'z'),(5,6,'r');
 
CREATE TABLE t2 (d VARCHAR(1), INDEX(d)) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('x'),('a');
 
CREATE TABLE t3 (e VARCHAR(1)) ENGINE=MyISAM;
INSERT INTO t3 VALUES ('x'),('d');
 
PREPARE stmt FROM "
SELECT t1.* FROM t1 FORCE INDEX (c,a)
LEFT JOIN ( 
  SELECT * FROM t2 
  WHERE EXISTS ( SELECT * FROM t3 WHERE e != d ) 
) AS sq ON (sq.d = c ) 
WHERE c < 'p' OR a > 43 
ORDER BY t1.b
";
 
EXECUTE stmt;
EXECUTE stmt;

However, I am not getting the valgrind failure with it on a prefixed MySQL 5.5/5.6, so I guess it's not exactly the same.

Generated at Thu Feb 08 06:53:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.