diff --git a/mariadb-mtr.patch b/mariadb-mtr.patch new file mode 100644 index 0000000..592f73c --- /dev/null +++ b/mariadb-mtr.patch @@ -0,0 +1,70 @@ +diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl +index 594e052a16e..6a274b2d597 100755 +--- a/mysql-test/mariadb-test-run.pl ++++ b/mysql-test/mariadb-test-run.pl +@@ -1491,7 +1491,6 @@ sub command_line_setup { + mtr_warning ("Port base $opt_port_base rounded down to multiple of 10"); + $opt_port_base-= $rem; + } +- $opt_build_thread= $opt_port_base / 10 - 1000; + } + + # -------------------------------------------------------------------------- +@@ -1719,11 +1718,6 @@ sub command_line_setup { + # an environment variable can be used to control all ports. A small + # number is to be used, 0 - 16 or similar. + # +-# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x +-# versions of this script, else a 4.0 test run might conflict with a +-# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means +-# all port numbers might not be used in this version of the script. +-# + # Also note the limitation of ports we are allowed to hand out. This + # differs between operating systems and configuration, see + # http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html +@@ -1734,10 +1728,14 @@ sub set_build_thread_ports($) { + + if ( lc($opt_build_thread) eq 'auto' ) { + my $found_free = 0; +- $build_thread = 300; # Start attempts from here +- my $build_thread_upper = $build_thread + ($opt_parallel > 1500 +- ? 3000 +- : 2 * $opt_parallel) + 300; ++ if ($opt_port_base eq "auto") { ++ $build_thread = 15000; ++ } else { ++ $build_thread = $opt_port_base; ++ } ++ $build_thread += ($thread - 1) * $opt_port_group_size; ++ my $build_thread_upper = $build_thread + $opt_parallel * 2; ++ + while (! $found_free) + { + $build_thread= mtr_get_unique_id($build_thread, $build_thread_upper); +@@ -1754,7 +1752,7 @@ sub set_build_thread_ports($) { + } + else + { +- $build_thread = $opt_build_thread + $thread - 1; ++ $build_thread = $opt_port_base + $thread - 1; + if (! check_ports_free($build_thread)) { + # Some port was not free(which one has already been printed) + mtr_error("Some port(s) was not free") +@@ -1763,7 +1761,7 @@ sub set_build_thread_ports($) { + $ENV{MTR_BUILD_THREAD}= $build_thread; + + # Calculate baseport +- $baseport= $build_thread * $opt_port_group_size + 10000; ++ $baseport= $build_thread; + if ( $baseport < 5001 or $baseport + $opt_port_group_size >= 32767 ) + { + mtr_error("MTR_BUILD_THREAD number results in a port", +@@ -2968,7 +2966,7 @@ sub kill_leftovers ($) { + sub check_ports_free ($) + { + my $bthread= shift; +- my $portbase = $bthread * $opt_port_group_size + 10000; ++ my $portbase = $bthread; + for ($portbase..$portbase+($opt_port_group_size-1)){ + if (mtr_ping_port($_)){ + mtr_report(" - 'localhost:$_' was not free"); diff --git a/mariadb.spec b/mariadb.spec index a7836de..2b83fd4 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -229,6 +229,8 @@ Patch17: upstream_5cc2096f93b7f130b36f8bc0fc43440db9a848e4.patch # Patch13: bundle the FMT library Patch13: %{pkgnamepatch}-libfmt.patch +# Patch14: make MTR port calculation reasonably predictable +Patch14: %{pkgnamepatch}-mtr.patch BuildRequires: cmake gcc-c++ BuildRequires: multilib-rpm-config @@ -764,6 +766,7 @@ rm -r storage/rocksdb/ %if %{with bundled_fmt} %patch -P13 -p1 %endif +%patch -P14 -p1 # The test in Patch 10 has been recently updated by upstream # and the test was disabled in the testuite run # main.ssl_cipher [ disabled ] MDEV-17184 - Failures with OpenSSL 1.1.1 @@ -1221,14 +1224,6 @@ rm %{buildroot}%{_mandir}/man1/mbstream.1* %check %if %{with test} %if %runselftest -# hack to let 32- and 64-bit tests run concurrently on same build machine -export MTR_PARALLEL=1 -# Builds might happen at the same host, avoid collision -# The port used is calculated as 20 * MTR_BUILD_THREAD + 10000 -# The resulting port must be between 5000 and 32767 -# This is the same as using option "--build-thread" for the "mysql-test-run.pl" -export MTR_BUILD_THREAD=$(( $(date +%s) % 1100 )) - # The cmake build scripts don't provide any simple way to control the # options for mysql-test-run, so ignore the make target and just call it # manually. Nonstandard options chosen are: @@ -1249,7 +1244,7 @@ export MTR_BUILD_THREAD=$(( $(date +%s) % 1100 )) set -ex cd %{buildroot}%{_datadir}/mysql-test - export common_testsuite_arguments=" --parallel=auto --force --retry=2 --suite-timeout=900 --testcase-timeout=30 --mysqld=--binlog-format=mixed --force-restart --shutdown-timeout=60 --max-test-fail=5 " + export common_testsuite_arguments=" --port-base=$(( $(date +%s) % 20000 + 10000 )) --parallel=auto --force --retry=2 --suite-timeout=900 --testcase-timeout=30 --mysqld=--binlog-format=mixed --force-restart --shutdown-timeout=60 --max-test-fail=5 " # If full testsuite has already been run on this version and we don't explicitly want the full testsuite to be run if [[ "%{last_tested_version}" == "%{version}" ]] && [[ %{force_run_testsuite} -eq 0 ]]