Skip to content

Commit eb59d12

Browse files
committed
fix(restore): allow incrementalFrom to be 1 in restore API (#8988)
This is a minor inconvenience while using the incremental restore API that when incrementalFrom is set to 1, we throw an error back. The restore API takes two backup numbers incrementalFrom & backupNum and restores all the backups including both the ends, i.e. following set notation all the backups in the set [incrementalFrom, backupNum] are restored. This should work fine when incrementalFrom is set to 1 which is a full backup.
1 parent 6357cb4 commit eb59d12

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

systest/integration2/incremental_restore_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ func TestIncrementalRestore(t *testing.T) {
6868
t.Logf("restoring backup #%v\n", i)
6969

7070
incrFrom := i - 1
71-
if i == 2 {
72-
incrFrom = 0
73-
}
7471
require.NoError(t, hc.Restore(c, dgraphtest.DefaultBackupDir, "", incrFrom, i))
7572
require.NoError(t, dgraphtest.WaitForRestore(c))
7673

worker/online_restore.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,14 @@ func handleRestoreProposal(ctx context.Context, req *pb.RestoreRequest, pidx uin
245245
return errors.Errorf("nil restore request")
246246
}
247247

248+
// This is a minor inconvenience while using the incremental restore API that
249+
// when incrementalFrom is set to 1, we throw an error back. The restore API
250+
// takes two backup numbers incrementalFrom & backupNum and restores all the
251+
// backups including both the ends, i.e. following set notation all the backups
252+
// in the set [incrementalFrom, backupNum] are restored. This should work fine
253+
// when incrementalFrom is set to 1 which is a full backup.
248254
if req.IncrementalFrom == 1 {
249-
return errors.Errorf("Incremental restore must not include full backup")
255+
req.IncrementalFrom = 0
250256
}
251257

252258
// Clean up the cluster if it is a full backup restore.

0 commit comments

Comments
 (0)