You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MDEV-11668 rpl.rpl_heartbeat_basic fails sporadically in buildbot
On a slow builder, a delay between binlog events on master could
occur, which would cause a heartbeat which is not expected by the
test. The solution is to monitor the timing of binlog events
on the master and only perform the heartbeat check if no critical
delays have happened.
Additionally, an unused variable was removed (this change is
unrelated to the bugfix).
let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
357
-
# Wait some updates for table t1 from master
358
-
let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5;
359
-
--source include/wait_condition.inc
357
+
358
+
--connection master
359
+
360
+
# Whether or not to send a heartbeat is decided on the master, based on
361
+
# whether the binlog was updated during the period or not.
362
+
# Even with the 1-second event, we cannot make the master to write binary
363
+
# logs (or execute SQL) in a timely manner. We can only check that they
364
+
# were executed in a timely manner, and if they were not, neutralize the
365
+
# heartbeat check on the slave.
366
+
# We will wait for 5 events, and keep checking 'Binlog_commits' on master.
367
+
# Time interval between consequent events will be measured.
368
+
# We can only expect that no heartbeats have been sent if the interval
369
+
# between events never exceeded MASTER_HEARTBEAT_PERIOD.
370
+
# If it has exceeded the value at least once, the slave can legitimately
371
+
# receive a heartbeat (but we cannot require it, because the delay
372
+
# could have occurred somewhere else, e.g. upon checking the status).
373
+
# So, if the delay is detected, we will signal slave to ignore possible
374
+
# heartbeats.
375
+
376
+
let $possible_heartbeats= 0;
377
+
let $commits_to_wait= 5;
378
+
while ($commits_to_wait)
379
+
{
380
+
let $tm= `SELECT UNIX_TIMESTAMP(NOW(3))`;
381
+
let $binlog_commits= query_get_value(SHOW STATUS LIKE 'Binlog_commits', Value, 1);
382
+
let $wait_condition= SELECT VARIABLE_VALUE > $binlog_commits FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME= 'BINLOG_COMMITS';
383
+
--source include/wait_condition.inc
384
+
dec $commits_to_wait;
385
+
if (`SELECT UNIX_TIMESTAMP(NOW(3)) > $tm + 5`)
386
+
{
387
+
let $possible_heartbeats= 1;
388
+
let $commits_to_wait= 0;
389
+
}
390
+
}
391
+
392
+
--connection slave
360
393
let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
361
-
let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
362
-
--echo Number of received heartbeat events: $result
394
+
let $result= `SELECT CASE WHEN $possible_heartbeats THEN 'TRUE' WHEN $rcvd_heartbeats_after - $rcvd_heartbeats_before > 0 THEN 'FALSE' ELSE 'TRUE' END`;
395
+
--echo Received heartbeats meet expectations: $result
363
396
--connection master
364
397
DELETE FROM t1;
365
398
DROP EVENT e1;
366
399
--sync_slave_with_master
367
400
--echo
368
401
369
-
370
402
# Check received heartbeat events while logs flushed on slave
0 commit comments