Bug #62340 main.endspace sporadic fails
Submitted: 3 Sep 2011 7:55 Modified: 26 Dec 2011 20:14
Reporter: Oleg Tsarev Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.1.60,5.5.20,5.6.4 OS:Any
Assigned to: CPU Architecture:Any

[3 Sep 2011 7:55] Oleg Tsarev
Description:
http://jenkins.percona.com/view/Percona%20Server%205.1/job/percona-server-5.1-centos/4/BUI...

main.endspace                            w1 [ fail ]
        Test ended at 2011-09-02 13:46:27

CURRENT_TEST: main.endspace
--- /home/jenkins/workspace/percona-server-5.1-centos/BUILD_TYPE/release/Host/centos5-32/Percona-Server-5.1.58-rel12.9/mysql-test/r/endspace.result	2011-07-01 18:36:01.000000000 +0300
+++ /home/jenkins/workspace/percona-server-5.1-centos/BUILD_TYPE/release/Host/centos5-32/Percona-Server-5.1.58-rel12.9/mysql-test/r/endspace.reject	2011-09-02 20:46:26.000000000 +0300
@@ -203,13 +203,13 @@
 teststring 
 select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
 text1	length(text1)
-teststring		11
 teststring	10
+teststring		11
 teststring 	11
 select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
 text1	length(text1)
-teststring		11
 teststring	10
+teststring		11
 teststring 	11
 select concat('|', text1, '|') from t1 order by text1;
 concat('|', text1, '|')

How to repeat:
Run tests on CentOS 5 (for example)

Suggested fix:
--- a/mysql-test/r/endspace.result
+++ b/mysql-test/r/endspace.result
@@ -201,12 +201,12 @@
 text1
 teststring	
 teststring 
-select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
+select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%' order by 1,2;
 text1	length(text1)
 teststring		11
 teststring	10
 teststring 	11
-select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
+select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t' order by 1,2;
 text1	length(text1)
 teststring		11
 teststring	10
--- a/mysql-test/t/endspace.test
+++ b/mysql-test/t/endspace.test
@@ -93,8 +93,8 @@
 select * from t1 where text1 like 'teststring_%';
 
 # The following gives wrong result in InnoDB
-select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
-select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
+select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%' order by 1,2;
+select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t' order by 1,2;
 select concat('|', text1, '|') from t1 order by text1;
 drop table t1;
[5 Sep 2011 17:35] MySQL Verification Team
Could you please try MySQL source. I couldn't repeat:

=============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
main.endspace                            [ pass ]   2596
------------------------------------------------------------
The servers were restarted 0 times
Spent 2.596 of 25 seconds executing testcases

Thanks.
[5 Sep 2011 18:31] Oleg Tsarev
Anycase - this test case is incorrect, because we have no guarantees about output order.
On your current source code all right, on XtraDB (innodb_plugin based) order is different, and this order can be different on new version of InnoDB.
According to what I have written before, test case should be fixed.h
[16 Dec 2011 8:13] Bjørn Munch
An alternative fix is to add a --sorted_result before the query; this is the typical use case for that.
[26 Dec 2011 20:14] Sveta Smirnova
Thank you for the report.

Verified as described: these 2 queries could produce different result.