Bug #51699 Incorrect key file error for temporary table with next-mr and RQG testing
Submitted: 3 Mar 2010 18:14 Modified: 6 Apr 2010 23:30
Reporter: Patrick Crews Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:MySQL 5.5.99-m3-debug-log OS:Any
Assigned to: Patrick Crews CPU Architecture:Any
Tags: ER_NOT_KEYFILE

[3 Mar 2010 18:14] Patrick Crews
Description:
The RQG is detecting an incorrect key file error for a temporary table in the mysql-next-mr tree - MySQL 5.5.99-m3-debug-log

This does not occur in 5.1-bugteam, or 6.0-codebase-bugfixing and is consistently repeatable with the RQG parameters shown below

# 11:40:58 Query:  

SELECT     table3 . `col_varchar_10_latin1` AS field1 ,  
                  table1 . `col_varchar_10_utf8_key` AS field2 , 
                  table1 . `col_varchar_1024_latin1_key` AS field3 , 
                  table1 . `col_int_key` AS field4 , 
                  table1 . `col_int_key` AS field5 ,  
                  table2 . `col_datetime` AS field6 
FROM  W AS table1  
            LEFT  JOIN  Q AS table2  
            LEFT  JOIN  W AS table3  
            LEFT  JOIN T AS table4 
           ON  table3 . `col_varchar_1024_latin1_key` <  table4 . `col_varchar_10_latin1_key`  
           ON  table2 . `pk` >  table3 . `col_int`  
           ON  table1 . `col_int_key` <  table3 . `pk`  
WHERE   table1 . `col_int_key` <> 6 
           OR table1 . `col_int_key` IS NOT NULL 
           AND   table1 . `pk` < 10 
           OR table1 . `pk` <= table1 . `pk` 
           AND  table1 . `col_varchar_1024_utf8` <= table1 . `col_varchar_10_latin1_key` 
           OR table1 . `col_int` >= table4 . `pk` 
           AND table1 . `col_varchar_10_utf8` <> table3 . `col_varchar_10_utf8_key` 
           AND table1 . `col_int_key` IS  NULL   
           ORDER BY field1, field2, field3, field4, field5, field6 ASC  

failed: 126 Incorrect key file for table 'k/grammar_write/mysql-next-mr/mysql-test/var/tmp/#sql_14a5_0.MYI'; try to repair it

This seems similar to Bug#48859	Create temporary, alter, analyze, table yields 'Incorrect key file for table', but it is not present in the 6.0 trees I tested, nor do I see an assertion failing when using debug binaries.

How to repeat:
Use the RQG comparing 5.1 vs next-mr:
perl ./runall.pl --threads=1 --Validator=ResultsetComparatorSimplify --basedir1=/path/mysql-next-mr --basedir2=/path/mysql-5.1 --mtr-build-thread=101 --gendata=conf/range_access.zz --grammar=conf/grm_exp1.yy --queries=200000 --debug --seed=1267474866

I am currently working on a simplified test case, will post once it has been created.
[3 Mar 2010 18:20] Patrick Crews
NOTE:  In the 'how to repeat' section, the RQG call should be:
perl ./runall.pl --threads=1 --Validator=ResultsetComparatorSimplify --basedir1=/path/mysql-next-mr --basedir2=/path/mysql-5.1 --mtr-build-thread=101 --gendata=conf/optimizer/range_access.zz --grammar=conf/optimizer/optimizer_access_exp.yy --queries=200000 --debug --seed=1267474866
[6 Apr 2010 23:30] Patrick Crews
Analysis has shown that this isn't a bug, but simply running out of tmp space.  Closing this out.