Skip to content

Commit

Permalink
Merge pull request #580 from signal18/caff_dev
Browse files Browse the repository at this point in the history
Add additional condition to prevent unwanted purge on slave
  • Loading branch information
svaroqui authored May 8, 2024
2 parents 2f353e1 + 1113112 commit 5f4ea7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cluster/srv_binlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func (server *ServerMonitor) JobBinlogPurgeSlave() {
}

//Purge slaves to oldest master binlog timestamp and skip if slave only has 1 binary logs file left
if master.OldestBinaryLogTimestamp > server.OldestBinaryLogTimestamp && len(server.BinaryLogFiles) > 1 {
if server.OldestBinaryLogTimestamp > 0 && master.OldestBinaryLogTimestamp > server.OldestBinaryLogTimestamp && len(server.BinaryLogFiles) > 1 {
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModGeneral, LvlInfo, "Purging slave binlog of %s from %s until oldest timestamp on master: %s", server.URL, time.Unix(server.OldestBinaryLogTimestamp, 0).String(), time.Unix(master.OldestBinaryLogTimestamp, 0).String())
q, err := dbhelper.PurgeBinlogBefore(server.Conn, master.OldestBinaryLogTimestamp)
if err != nil {
Expand Down

0 comments on commit 5f4ea7f

Please sign in to comment.