Bug #16780 mysql-test-run does not set NDBCLUSTER_PORT_SLAVE with MTR_BUILD_THREAD
Submitted: 25 Jan 2006 13:53 Modified: 3 Mar 2006 2:34
Reporter: Ingo Strüwing Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.1.6 OS:UNIX, Linux
Assigned to: Kent Boortz CPU Architecture:Any

[25 Jan 2006 13:53] Ingo Strüwing
Description:
DISCLAIMER: Unfortunaltely we do not have a "Server, Testing" category. So I choose "Server, compiling". Perhaps we should understand testing as belonging to compiling?

When setting MTR_BUILD_THREAD in the environment with different values in different sessions (or terminal windows) and running mysql-test-run in each, NDBCLUSTER_PORT_SLAVE still has the same (default) value in all sessions.

The error I get (for example in rpl_ndb_bank.test):

Unable to setup port: *:9358!
Please check if the port is already used,
(perhaps a ndb_mgmd is already running),
and if you are executing on the correct computer
Unable to start /home/mydev/mysql-5.1-bug5390/storage/ndb/src/mgmsrv/ndb_mgmd --no-defaults  from /home/mydev/mysql-5.1-bug5390/mysql-test

The problem is that I can run one 5.1/5.2 test at the same time only. This is a big burden and costs much time. It is even worse since I use to run normal and ps-protocol tests for properly symlinked trees at the same time. This bug prevents me from doing it in 5.1/5.2.

How to repeat:
Session (xterm) 1:

cd somewhere
bk clone bk-internal.mysql.com:/home/bk/mysql-5.1-new mysql-5.1-test1
cd mysql-5.1-test1
MTR_BUILD_THREAD=240
BUILD/compile-pentium-debug-max
Wait until session 2 build is complete
make test

Session (xterm) 2:

cd somewhere
bk clone bk-internal.mysql.com:/home/bk/mysql-5.1-new mysql-5.1-test2
cd mysql-5.1-test2
MTR_BUILD_THREAD=224
BUILD/compile-pentium-debug-max
Wait until session 1 build is complete
make test

Suggested fix:
 # number is to be used, 0 - 16 or similar.
 #
 if [ -n "$MTR_BUILD_THREAD" ] ; then
-  MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 5 + 10000`
+  MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 6 + 10000`
   MYSQL_MANAGER_PORT=`expr $MASTER_MYPORT + 2`
   SLAVE_MYPORT=`expr $MASTER_MYPORT + 3`
   NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 4`
+  NDBCLUSTER_PORT_SLAVE=`expr $MASTER_MYPORT + 5`
 
   echo "Using MTR_BUILD_THREAD      = $MTR_BUILD_THREAD"
   echo "Using MASTER_MYPORT         = $MASTER_MYPORT"

or, probably even better (leaving room for 5 slaves):

 # number is to be used, 0 - 16 or similar.
 #
 if [ -n "$MTR_BUILD_THREAD" ] ; then
-  MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 5 + 10000`
+  MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000`
   MYSQL_MANAGER_PORT=`expr $MASTER_MYPORT + 2`
-  SLAVE_MYPORT=`expr $MASTER_MYPORT + 3`
-  NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 4`
+  NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 3`
+  NDBCLUSTER_PORT_SLAVE=`expr $MASTER_MYPORT + 4`
+  SLAVE_MYPORT=`expr $MASTER_MYPORT + 5`
 
   echo "Using MTR_BUILD_THREAD      = $MTR_BUILD_THREAD"
   echo "Using MASTER_MYPORT         = $MASTER_MYPORT"
[25 Jan 2006 13:56] Ingo Strüwing
Sorry, I forgot to mention "export MTR_BUILD_THREAD" in the "How to repeat" section.
[28 Jan 2006 11:36] 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/1774
[13 Feb 2006 15:56] Ingo Strüwing
I see you fixed the script so that there is more space for slave servers. But why do you not calculate a port number for NDBCLUSTER_PORT_SLAVE like I suggested? Is this not necessary? Is the NDB slave  fine with a single port on a machine running several test suites at once? I know this is not needed before 5.1. But how about the newer versions?

Regards
Ingo
[17 Feb 2006 20:55] 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/2827