Fixed WAL gc age bug

This commit is contained in:
jdl 2023-12-05 09:54:41 +01:00
parent b251368b09
commit 875957f662

View File

@ -15,7 +15,7 @@ func (rep *Replicator) runWALGC() {
select { select {
case <-ticker.C: case <-ticker.C:
state := rep.getState() state := rep.getState()
before := time.Now().Unix() - rep.conf.WALSegMaxAgeSec before := time.Now().Unix() - rep.conf.WALSegGCAgeSec
if err := rep.wal.DeleteBefore(before, state.SeqNum); err != nil { if err := rep.wal.DeleteBefore(before, state.SeqNum); err != nil {
log.Printf("[WAL-GC] failed to delete wal segments: %v", err) log.Printf("[WAL-GC] failed to delete wal segments: %v", err)
} }