Skip to content

Commit 882c80b

Browse files
authored
Merge pull request #201 from cybozu-go/fix/smallerIDs-error-msg
fix: improve snapID precondition error message
2 parents e4ef8f9 + 0ddd1e7 commit 882c80b

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)