Bug #55599 mtr can only run 10 servers at the same time
Submitted: 28 Jul 2010 11:53 Modified: 29 Jul 2010 7:21
Reporter: Sven Sandberg Email Updates:
Status: Verified Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S7 (Test Cases)
Version:5.1+ OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any

[28 Jul 2010 11:53] Sven Sandberg
Description:
mtr limits the number of servers that can run at the same time to 10, because it computes port numbers like this:

10000 + $MTR_BUILD_THREAD * 10 + N,

where N is the server number within the test. So if a test that runs with $MTR_BUILD_THREAD=1 uses 11 servers, then the 11'th server will have the same port number as the first server in a test that runs with $MTR_BUILD_THREAD=2.

This limits what replication topologies are possible to test. E.g., in WL#5058 we will need more than 10 servers. The test case for BUG#49978 also needs more than 10 servers.

The test case for BUG#49978 will be disabled because of this bug.

How to repeat:
Use the test case rpl_test_framework from the fix of BUG#49978 and run the following in parallel:
shell1> MTR_BUILD_THREAD=1 ./mtr rpl_test_framework
shell2> MTR_BUILD_THREAD=1 ./mtr rpl_test_framework

Suggested fix:
Alternative 1: Change the number 10 to 100 in the formula above.

Alternative 2: Change the number 10 to a value that is configurable with an environment variable. Make the default 100 if the environment variable is not set.

Alternative 3: Change the number 10 to a value that is configurable with an environment variable. Make the default 10 if the environment variable is not set.

Alternative 4: Same as Alternative 2, and also create a new file
mysql-test/include/have_N_servers.inc , implemented as follows:
  if (`SELECT $MTR_MAX_SERVER_COUNT > $server_count`)
  {
    --skip Test requires at lest $server_count servers. Set \$MTR_MAX_SERVER_COUNT before running mtr.
  }
Use the file as follows:
  --let $server_count= 47
  --source include/have_N_servers.inc

If we choose Alternative 1 or 2, some people who currently rely on the constant 10 may have to update their scripts. Also, checking available ports is slow on windows and therefore it may unnecessarily slow down running tests that need at most 10 servers on windows.

If we choose Alternative 3, we still have to disable all tests that need more than 10 servers, since otherwise they would fail by default when people run them locally.

If we choose Alternative 4, we can use include/have_N_servers.inc instead of disabling a test. It is up to the user to manually increase the number of servers. This can be done easily on pb2 hosts.
[28 Jul 2010 11:57] Sven Sandberg
Correction: Alternative 4 is based on Alternative *3* (not Alternative 2). So in Alternative 4, the default value is 10, not 100.
[29 Jul 2010 7:21] Sveta Smirnova
Thank you for the report.

Verified as described. Although I think you mean set MTR_BUILD_THREAD=2 in second shell