Skip to content

Commit

Permalink
truncate must less than compact
Browse files Browse the repository at this point in the history
  • Loading branch information
RidRisR committed Jan 15, 2025
1 parent c10b4e5 commit 8b69ce0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/backup/backupschedule/backup_schedule_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package backupschedule

import (
"fmt"
"math"
"path"
"sort"
"strings"
Expand Down Expand Up @@ -654,6 +655,19 @@ func (bm *backupScheduleManager) backupGCByMaxReservedTime(bs *v1alpha1.BackupSc
klog.Infof("backup schedule %s/%s gc backup %s success", ns, bsName, backup.GetName())
}

var compactProgress uint64
if bs.Spec.CompactBackupTemplate == nil {
compactProgress = math.MaxUint64
} else if bs.Status.LastCompactTime == nil {
compactProgress = 0
} else {
compactProgress = config.GoTimeToTS(bs.Status.LastCompactTime.Time)
}

if truncateTSO > compactProgress {
truncateTSO = compactProgress
}

if truncateTSO > 0 {
// truncate the log backup
if err = bm.deps.BackupControl.TruncateLogBackup(logBackup, truncateTSO); err != nil {
Expand Down

0 comments on commit 8b69ce0

Please sign in to comment.