Bug #47666 ndb_basic test fails due to incorrect result file
Submitted: 28 Sep 2009 3:02 Modified: 29 Sep 2009 6:51
Reporter: Arjen Lentz Email Updates:
Status: Verified Impact on me:
None 
Category:Tests: Cluster Severity:S3 (Non-critical)
Version:mysql-5.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.0.86, mysql-test-run, ndb
Triage: Triaged: D2 (Serious) / R6 (Needs Assessment) / E6 (Needs Assessment)

[28 Sep 2009 3:02] Arjen Lentz
Description:
ndb_basic test fails.

$ sudo diff -u ndb_basic.result ndb_basic.reject 
--- ndb_basic.result	2009-09-28 11:16:13.000000000 +1000
+++ ndb_basic.reject	2009-09-28 11:36:07.000000000 +1000
@@ -568,7 +568,7 @@
 insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
 explain select * from t1 where a12345678901234567890123456789a1234567890=2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ref	a12345678901234567890123456789a1234567890	a12345678901234567890123456789a1234567890	5	const	10	Using where
+1	SIMPLE	t1	ref	a12345678901234567890123456789a1234567890	a12345678901234567890123456789a1234567890	5	const	10	Using where with pushed condition
 select * from t1 where a12345678901234567890123456789a1234567890=2;
 a1234567890123456789012345678901234567890	a12345678901234567890123456789a1234567890
 5	2

How to repeat:
Build with ndb enabled, run tests.

Suggested fix:
Update result file as shown above. The result is correct.

I appreciate that MySQL 5.0/5.1 do not have a current/production version of NDB included, however people can build with ndb enabled (Ubuntu does so!) and thus it'd be great if the test didn't fail.
Thanks
[28 Sep 2009 3:08] Arjen Lentz
https://bugs.launchpad.net/mysql-server/+bug/437934
[28 Sep 2009 5:18] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior. Please send us configure options you used.
[28 Sep 2009 5:40] Arjen Lentz
That q gets a bit complicated since it's the result of a larger build process, but it should not be necessary since the fundamentals are pretty clear.

From the output, I presume that --engine-condition-pushdown gets enabled, which is fine since you really really want/need that with NDB.
It's not something that magically gets added and the default is off, so I presume it's enabled by the testsuite. Again entirely correct.
And consequentially the test output is also correct, but the the result file is wrong.

When you try to reproduce, do you see the testsuite run all the ndb_* tests?
If not, then you don't have NDB enabled at all in your build; enable and try again.
thanks
[28 Sep 2009 5:56] Sveta Smirnova
Thank you for the feedback.

But ndb is enabled in my build.
[28 Sep 2009 6:33] Jonas Oreland
could there be some earlier test that enables the flag,
and forget to disable it once done ?
(note: i haven't checked...since i don't have a 5.0 nearby)

if you're using mtr 2, it should complain if that's the case.
(again, don't know if mtr 2 is in 5.0)
[28 Sep 2009 7:13] Susanne Ebrecht
I tested with actual 5.0 bzr tree.

It seems that the tests were removed.

ERROR: Test case ndb_basic.result is not found

ERROR: Test case ndb_basic.reject is not found
[28 Sep 2009 8:05] Susanne Ebrecht
WARNING: Could not find all required ndb binaries, all ndb tests will fail, use --skip-ndbcluster to skip testing it.

ndb_basic                      [ fail ]

ERROR: Failed to find cluster binaries

I think that is logical. But I tried lots of different ways now how to compile it and always run into that issue.

It seems that it is not possible here on my machine to compile 5.0 with ndb support.
[28 Sep 2009 10:34] Arjen Lentz
Any of the BUILD/compile-* scripts with -max but not containing -no-ndb should get you NDB binaries, as it's enabled by the -max build profile.
[28 Sep 2009 15:08] Valeriy Kravchuk
Verified just as described with both 5.0.86 on Ubuntu and recent 5.0.87 from bzr on Mac OS X:

valeriy-kravchuks-macbook-pro:mysql-test openxs$ ./mysql-test-run.pl ndb_basic
Logging: ./mysql-test-run.pl ndb_basic
MySQL Version 5.0.87
Using ndbcluster when necessary, mysqld supports it
Skipping SSL, mysqld not compiled with SSL
Using MTR_BUILD_THREAD      = 0
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Using NDBCLUSTER_PORT       = 9311
Using IM_PORT               = 9313
Using IM_MYSQLD1_PORT       = 9314
Using IM_MYSQLD2_PORT       = 9315
Killing Possible Leftover Processes
Removing Stale Files
Creating Directories
Installing Master Database
Installing Master Database
Installing Master Cluster
=======================================================
Starting Tests in the 'main' suite

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

ndb_basic                      [ pass ]          35167
-------------------------------------------------------
Stopping All Servers
All 1 tests were successful.
The servers were restarted 1 times
Spent 35.167 of 91 seconds executing testcases

valeriy-kravchuks-macbook-pro:mysql-test openxs$ ./mysql-test-run.pl --mysqld="--engine-condition-pushdown=1" ndb_basic
Logging: ./mysql-test-run.pl --mysqld=--engine-condition-pushdown=1 ndb_basic
MySQL Version 5.0.87
Using ndbcluster when necessary, mysqld supports it
Skipping SSL, mysqld not compiled with SSL
Using MTR_BUILD_THREAD      = 0
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Using NDBCLUSTER_PORT       = 9311
Using IM_PORT               = 9313
Using IM_MYSQLD1_PORT       = 9314
Using IM_MYSQLD2_PORT       = 9315
Killing Possible Leftover Processes
Removing Stale Files
Creating Directories
Installing Master Database
Installing Master Database
Installing Master Cluster
=======================================================
Starting Tests in the 'main' suite

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

ndb_basic                      [ fail ]

--- /Users/openxs/bzr/mysql-5.0-work/mysql-test/r/ndb_basic.result	2009-02-16 22:17:31.000000000 +0300
+++ /Users/openxs/bzr/mysql-5.0-work/mysql-test/r/ndb_basic.reject	2009-09-28 18:06:17.000000000 +0300
@@ -568,7 +568,7 @@
 insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
 explain select * from t1 where a12345678901234567890123456789a1234567890=2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ref	a12345678901234567890123456789a1234567890	a12345678901234567890123456789a1234567890	5	const	10	Using where
+1	SIMPLE	t1	ref	a12345678901234567890123456789a1234567890	a12345678901234567890123456789a1234567890	5	const	10	Using where with pushed condition
 select * from t1 where a12345678901234567890123456789a1234567890=2;
 a1234567890123456789012345678901234567890	a12345678901234567890123456789a1234567890
 5	2

mysqltest: Result content mismatch

Aborting: ndb_basic failed in default mode. 
To continue, re-run with '--force'.
Stopping All Servers

So, it is all about engine_condition_pushdown=1.
[29 Sep 2009 4:33] Arjen Lentz
Suzanne - ye that doesn't prove it really, as it doesn't explain where the setting comes from in my build. But I think I've found it:

I can't see any spot enabling condition pushdown from outside the test commands themselves... however, most tests that affect it use

set @old_ecpd = @@session.engine_condition_pushdown;
...
set engine_condition_pushdown = @old_ecpd;

But grep shows that ndb_gis does not.
So, depending on whether mysql-test-run restarts a connection or mysqld somewhere after that test and before ndb_basic, it'll fail.
For my environment it consistently fails, so I'm going to try patching the ndb_gis test and running with that. I'll let you know.
[29 Sep 2009 6:51] Arjen Lentz
Hmm this is interesting. I applied a patch and now ndb_basic fails with the following error:
query 'set engine_condition_pushdown = @old_ecpd' failed: 1231: Variable 'engine_condition_pushdown' can't be set to the value of 'NULL'

The patch is below (also fixes the ndb_gis issue).
Now, as you can see @old_ecpd is set at the top, and used to restore later. The restore fails as apparently @old_ecpd is NULL. It can only be NULL if it's a new connection (unset @vars are NULL). So question to you is, where in the middle of the ndb_basic.test does it go to a new connection (or restart mysql server, crash mysqld, use another cluster sql node, whatever).
The cause of that may clarify the cause of the original problem.

Index: mysql-5.0.86/mysql-test/r/ndb_gis.result
===================================================================
--- mysql-5.0.86.orig/mysql-test/r/ndb_gis.result       2009-09-29 14:28:11.000000000 +1000
+++ mysql-5.0.86/mysql-test/r/ndb_gis.result    2009-09-29 14:35:55.000000000 +1000
@@ -1,4 +1,5 @@
 SET storage_engine=ndbcluster;
+set @old_ecpd = @@session.engine_condition_pushdown;
 DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
 CREATE TABLE gis_point  (fid INTEGER, g POINT);
 CREATE TABLE gis_line  (fid INTEGER, g LINESTRING);
@@ -1086,3 +1087,4 @@
 0
 DROP TABLE t1;
 End of 5.0 tests
+set engine_condition_pushdown = @old_ecpd;
Index: mysql-5.0.86/mysql-test/t/ndb_gis.test
===================================================================
--- mysql-5.0.86.orig/mysql-test/t/ndb_gis.test 2009-09-29 14:28:04.000000000 +1000
+++ mysql-5.0.86/mysql-test/t/ndb_gis.test      2009-09-29 14:34:48.000000000 +1000
@@ -1,5 +1,7 @@
 --source include/have_ndb.inc
 SET storage_engine=ndbcluster;
+set @old_ecpd = @@session.engine_condition_pushdown;
 --source include/gis_generic.inc
 set engine_condition_pushdown = on;
 --source include/gis_generic.inc
+set engine_condition_pushdown = @old_ecpd;
Index: mysql-5.0.86/mysql-test/r/ndb_basic.result
===================================================================
--- mysql-5.0.86.orig/mysql-test/r/ndb_basic.result     2009-09-29 15:09:06.000000000 +1000
+++ mysql-5.0.86/mysql-test/r/ndb_basic.result  2009-09-29 15:12:58.000000000 +1000
@@ -1,3 +1,5 @@
+set @old_ecpd = @@session.engine_condition_pushdown;
+set engine_condition_pushdown = 0;
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
 drop database if exists mysqltest;
 CREATE TABLE t1 (
@@ -866,3 +868,4 @@
 ccc    -ccc
 drop table t1;
 End of 5.0 tests
+set engine_condition_pushdown = @old_ecpd;
Index: mysql-5.0.86/mysql-test/t/ndb_basic.test
===================================================================
--- mysql-5.0.86.orig/mysql-test/t/ndb_basic.test       2009-09-29 15:09:12.000000000 +1000
+++ mysql-5.0.86/mysql-test/t/ndb_basic.test    2009-09-29 15:11:14.000000000 +1000
@@ -1,5 +1,7 @@
 -- source include/have_ndb.inc
 -- source include/not_embedded.inc
+set @old_ecpd = @@session.engine_condition_pushdown;
+set engine_condition_pushdown = 0;
 
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
@@ -802,3 +804,4 @@
 
 # End of 5.0 tests
 --echo End of 5.0 tests
+set engine_condition_pushdown = @old_ecpd;