Description:
When enabling mysql-test test cases for cluster using have_ndb.inc, the file makes use of the "have_multi_ndb.inc" file. That file, as a lat command, set the connection to 'server1'. As a result the test file execution starts using that connection. This is different from other have_XXX.inc files or a default use of mysql-test that uses the 'default' connection from the get go.
This can lead to inconsistencies in the behavior of test cases using multiple connections, as in the non-ndb case the tests will start in the 'default' connection and in the 'ndb' case they will start in the 'server1' connection.
How to repeat:
1) View the last line in mysql-test/include/have_multi_ndb.inc
2) This issue can also be demonstrated with the following test case:
set @omer_var='Testing Value';
connection default;
select @omer_var;
When running the test when 'have_ndb' is not used, the result of the select is
@omer_var
Testing Value
because the test started in the 'default' connection
When running the test when 'have_ndb' is used the result of the select is
@omer_var
NULL
because the initial setting if the variable is in the 'server1' connection and not the default one
Suggested fix:
have 'have_multi_ndb.inc' use 'default' as one of its connection and have it set to that one as its last line so test cases will behave the same when ndb is enabled and when it isn't