Skip to content

Commit 0ddd1e7

Browse files
committed
fix: improve snapID precondition error message
- Updated the error message to account for full backups created on other nodes. - Replaced the hard-coded threshold with a maxOlderFinBackups constant. Signed-off-by: Kyori Sakao <[email protected]>
1 parent e4ef8f9 commit 0ddd1e7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/controller/finbackup_controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ const (
5252
annotationRBDPool = "fin.cybozu.io/rbd-pool"
5353
AnnotationSkipVerify = "fin.cybozu.io/skip-verify"
5454
AnnotationFullBackup = "fin.cybozu.io/full-backup"
55+
56+
maxOlderFinBackups = 1
5557
)
5658

5759
type verificationJobStatus int
@@ -681,8 +683,8 @@ func snapIDPreconditionSatisfied(backup *finv1.FinBackup, otherFinBackups []finv
681683
return fmt.Errorf("found FinBackup not yet stored to node or verified: %s/%d", fb.Name, snapID)
682684
}
683685
smallerIDs++
684-
if smallerIDs >= 2 {
685-
return errors.New("found incremental FinBackup")
686+
if smallerIDs > maxOlderFinBackups {
687+
return fmt.Errorf("found too many older finbackups: %d (max: %d)", smallerIDs, maxOlderFinBackups)
686688
}
687689
}
688690
return nil

0 commit comments

Comments
 (0)