Bug #33866 Test 'ndb_config' has different result
Submitted: 14 Jan 2008 17:05 Modified: 15 Apr 2010 14:13
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1 OS:Any
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: 5.0 + 5.1

[14 Jan 2008 17:05] Joerg Bruehe
Description:
Difference in the 5.0 tests, specific to OS X on PPC-64bit.

The oldest occurrence I found is in 5.0.30, but it seems this never got reported.
It is at least in these versions: 5.0.30, 5.0.32, 5.0.30sp1, 5.0.34, 5.0.44, 5.0.45, 5.0.46, 5.0.50, 5.0.51, and 5.0.54a
It may also be in others whose logs were not split into separate test files.

=== Symptom ===
ndb_config                     [ fail ]

--- /PATH/mysql-test/r/ndb_config.result
+++ /PATH/mysql-test/r/ndb_config.reject
@@ -11,4 +11,4 @@
 shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tc
p,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6
 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55
,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
 1 2 3

-1 2 3
+

mysqltest: Result length mismatch
=== end of quote ===

Checking with the "result" file, I see these are the very last lines.
Looking at the test, I have absolutely no idea how to describe it:

=== test file end: ===
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=localhost --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=1.2.3.4   --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=127.0.0.1 --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
=== end of quote ===

How to repeat:
Found by running the test suite.
[3 Feb 2008 21:05] Jonas Oreland
it looks like localhost != 127.0.0.1
[14 Apr 2010 9:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/105613
[14 Apr 2010 9:44] Bugs System
Pushed into 5.1.44-ndb-7.0.15 (revid:magnus.blaudd@sun.com-20100414092831-oh31f8h1g4wfhkxz) (version source revid:magnus.blaudd@sun.com-20100414092831-oh31f8h1g4wfhkxz) (merge vers: 5.1.44-ndb-7.0.15) (pib:16)
[14 Apr 2010 9:47] Magnus Blåudd
Pushed to 7.0.15 and 7.1.4
[15 Apr 2010 12:33] Magnus Blåudd
The problem occured when localhost was used in config.ini which ndb_config then converted to a binary config and filtered to return only those hosts at 127.0.0.1.

Since the filtering compares the resolved value of localhost with resolved value of 127.0.0.1(which always resolves to 127.0.0.1) it will fail if localhost is not resolving to 127.0.0.1.

This problem was reproduced on a normal linux machine as well by editing /etc/hosts to return 127.0.0.2 for localhost.
[15 Apr 2010 14:13] Jon Stephens
There's no change in behaviour as such to be documented (thus no changelog entry), but after discussing with Magnus, I've added the following note to the description of ndb_config --host:

      While the hostname localhost usually resolves to the IP 
      address 127.0.0.1, this may not necessarily be true for 
      all operating platforms and configurations. This means 
      that it is possible, when localhost is used in config.ini, 
      for ndb_config --host=localhost to fail if ndb_config is run 
      on a different host where localhost resolves to a different 
      address (for example, on some versions of SUSE Linux, this is 
      127.0.0.2). In general, for best results, you should use 
      numeric IP addresses for all MySQL Clustewr configuration 
      values relating to hosts, or verify that all MySQL Cluster 
      hosts handle localhost in the same fashion.

Closed.