Skip to content

Commit e38d3f7

Browse files
committed
Set source_heartbeat_period as well as master_heartbeat_period.
1 parent 61638c4 commit e38d3f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

replication/binlogsyncer.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,12 @@ func (b *BinlogSyncer) registerSlave() error {
334334
}
335335

336336
if b.cfg.HeartbeatPeriod > 0 {
337-
_, err = b.c.Execute(fmt.Sprintf("SET @master_heartbeat_period=%d;", b.cfg.HeartbeatPeriod))
337+
_, err = b.c.Execute(fmt.Sprintf("SET @master_heartbeat_period = %s, @source_heartbeat_period = %s;",
338+
b.cfg.HeartbeatPeriod, b.cfg.HeartbeatPeriod))
338339
if err != nil {
339-
b.cfg.Logger.Error(fmt.Sprintf("failed to set @master_heartbeat_period=%d", b.cfg.HeartbeatPeriod), slog.Any("error", err))
340+
b.cfg.Logger.Error(
341+
fmt.Sprintf("failed to set @master_heartbeat_period=%d, @source_heartbeat_period=%d",
342+
b.cfg.HeartbeatPeriod, b.cfg.HeartbeatPeriod), slog.Any("error", err))
340343
return errors.Trace(err)
341344
}
342345
}

0 commit comments

Comments
 (0)