Skip to content

Commit e7a1b2b

Browse files
committed
fix: ignore node on snapIDPreconditionSatisfied()
Removed the node-check logic since the generation count spans across nodes. Signed-off-by: Kyori Sakao <[email protected]>
1 parent 0e077ff commit e7a1b2b

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

internal/controller/finbackup_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,6 @@ func snapIDPreconditionSatisfied(backup *finv1.FinBackup, otherFinBackups []finv
672672
if fb.Status.SnapID == nil {
673673
return fmt.Errorf("found another FinBackup with nil SnapID: %s", fb.Name)
674674
}
675-
if fb.Spec.Node != backup.Spec.Node {
676-
continue
677-
}
678675

679676
snapID := *fb.Status.SnapID
680677
if snapID > targetSnapID {

internal/controller/finbackup_controller_test.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,15 @@ func Test_snapIDPreconditionSatisfied(t *testing.T) {
13221322
backup: createFinBackup("new-backup", 3, "node1", true, nil),
13231323
otherFinBackups: []finv1.FinBackup{
13241324
*createFinBackup("backup", 2, "node1", true, nil),
1325-
*createFinBackup("other-backup", 1, "node2", false, nil),
1325+
*createFinBackup("other-backup", 1, "node2", true, nil),
1326+
},
1327+
wantErr: true,
1328+
},
1329+
{
1330+
name: "only FinBackup in different node",
1331+
backup: createFinBackup("new-backup", 2, "node1", true, nil),
1332+
otherFinBackups: []finv1.FinBackup{
1333+
*createFinBackup("other-backup", 1, "node2", true, nil),
13261334
},
13271335
wantErr: false,
13281336
},
@@ -1369,16 +1377,6 @@ func Test_snapIDPreconditionSatisfied(t *testing.T) {
13691377
},
13701378
wantErr: true,
13711379
},
1372-
{
1373-
name: "two smaller SnapIDs on different node",
1374-
backup: createFinBackup("new-backup", 4, "node2", true, nil),
1375-
otherFinBackups: []finv1.FinBackup{
1376-
*createFinBackup("other-1", 3, "node1", true, nil),
1377-
*createFinBackup("backup", 1, "node2", true, nil),
1378-
*createFinBackup("other-2", 2, "node1", true, nil),
1379-
},
1380-
wantErr: false,
1381-
},
13821380
}
13831381
for _, tt := range tests {
13841382
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)