1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-35304: Fix multi_source.connects_tried

Test multi_source.connects tried would sporadically fail with a result
mismatch resembling the following diff:

@@ -29,6 +29,7 @@
 SELECT @time_begin, CURRENT_TIMESTAMP(1)
 WHERE TIMESTAMPDIFF(SECOND, @time_begin, CURRENT_TIMESTAMP(1)) < 1;
 @time_begin  CURRENT_TIMESTAMP(1)
+2025-04-28 17:10:08.3  2025-04-28 17:10:09.2
 CREATE TEMPORARY TABLE status_sleep AS SELECT 'named' Connection_name, Connects_Tried Connects_Tried;
 SET @@SESSION.default_master_connection= '';
 include/wait_for_slave_param.inc [Connects_Tried]

This happened due to the reference variable @time_begin being set
_after_ the slave was started. That is, @time_begin was used as the
anchor point at which the time should start ticking for when
Connects_Tried should be incremented; however, MTR may not actually
be able to set it for some time after the slave had started due to
OS scheduling or heavy server load. The failure can be reproduced by
adding a 0.1s sleep statement in-between the aformentioned statements.

The fix is to set @time_begin before starting the slave so it is at
least always valid to reference as the start of the test case.
This commit is contained in:
Brandon Nesterenko
2025-04-29 09:57:52 -06:00
parent e1da2c3d67
commit 74c189c312
2 changed files with 2 additions and 2 deletions

View File

@ -10,8 +10,8 @@ SELECT Connection_name, Connects_Tried FROM information_schema.SLAVE_STATUS;
Connection_name Connects_Tried
0
named 0
START ALL SLAVES;
SET @time_begin= CURRENT_TIMESTAMP(1);
START ALL SLAVES;
SET @@SESSION.default_master_connection= 'named';
include/wait_for_slave_io_error.inc [errno=2003]
SET @@SESSION.default_master_connection= '';

View File

@ -24,8 +24,8 @@ CHANGE MASTER TO master_connect_retry=2;
SELECT Connection_name, Connects_Tried FROM information_schema.SLAVE_STATUS;
--disable_warnings
START ALL SLAVES; # will fail because the masters are down
SET @time_begin= CURRENT_TIMESTAMP(1);
START ALL SLAVES; # will fail because the masters are down
--enable_warnings
# CR_CONN_HOST_ERROR
--let $slave_io_errno= 2003