[MDEV-32185] MTR: --parallel does not work correctly when using LOOP Created: 2023-09-16  Updated: 2023-09-18  Resolved: 2023-09-16

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 11.3
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Roel Van de Paar Assignee: Sergei Golubchik
Resolution: Duplicate Votes: 0
Labels: affects-tests, mtr

Issue Links:
Duplicate
duplicates MDEV-21279 mtr repeat should be able to use para... Open

 Description   

Testcase (add as main/test.test or similar):

--delimiter $$
BEGIN NOT ATOMIC
  DECLARE CONTINUE HANDLER FOR 1210 BEGIN END;
  LOOP
    SELECT SLEEP(1);
  END LOOP;
END $$
--delimiter ;

Run with:

./mtr --parallel 10 --repeat 100 test

Output:

11.3.0 8ad1e26b1bafa4ed9928306efc10c047f2274108

...
Creating var directory '/test/MD110923-mariadb-11.3.0-linux-x86_64-dbg/mariadb-test/var'...
Checking supported features...
MariaDB Version 11.3.0-MariaDB-debug
 - SSL connections supported
 - binaries are debug compiled
 - binaries built with wsrep patch
Collecting tests...
Installing system database...
 
==============================================================================
 
TEST                                  WORKER RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
 
worker[8] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
worker[10] Using MTR_BUILD_THREAD 301, with reserved ports 16020..16039
worker[7] Using MTR_BUILD_THREAD 302, with reserved ports 16040..16059
worker[2] Using MTR_BUILD_THREAD 304, with reserved ports 16080..16099
worker[4] Using MTR_BUILD_THREAD 305, with reserved ports 16100..16119
worker[3] Using MTR_BUILD_THREAD 306, with reserved ports 16120..16139
worker[6] Using MTR_BUILD_THREAD 307, with reserved ports 16140..16159
worker[1] Using MTR_BUILD_THREAD 308, with reserved ports 16160..16179
worker[9] Using MTR_BUILD_THREAD 309, with reserved ports 16180..16199
worker[5] Using MTR_BUILD_THREAD 303, with reserved ports 16060..16079
BEGIN NOT ATOMIC
DECLARE CONTINUE HANDLER FOR 1210 BEGIN END;
LOOP
SELECT SLEEP(1);
END LOOP;
END $$

The issue is that only one of the parallel threads will start, while the others do not start at all. The selection of which thread starts seems either random or is based on timing (which thread is first to start):

/test/MD110923-mariadb-11.3.0-linux-x86_64-dbg/mariadb-test/var$ find . | grep 'mysqld.*err'
./3/log/mysqld.1.err

In this case, thread 3 started. No other threads will start . It is quite possible that other types of SQL will also create the same issue.

Set to critical as fixing this may, or may not (depends on the underlying bug), significantly affect MTR's --parallel performance.
Feel free to lower once the issue is better understood.



 Comments   
Comment by Sergei Golubchik [ 2023-09-16 ]

it was always like this, for the last 20 years, since mtr was created.
It has nothing to do with LOOP, one test is run by one worker, even when you use --repeat.
It's sometimes annoying, indeed, and a common workaround is to run

$ ./mtr test{,,,,,,,,}

Comment by Roel Van de Paar [ 2023-09-18 ]

Thank you, understood

Generated at Thu Feb 08 10:29:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.