Skip to content

Commit

Permalink
fix(restore): allow incrementalFrom to be 1 in restore API
Browse files Browse the repository at this point in the history
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 a from backup number (incrementalFrom) and a
to backup number (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.
  • Loading branch information
mangalaman93 committed Sep 2, 2023
1 parent 4c9448a commit 88c4524
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions systest/integration2/incremental_restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ func TestIncrementalRestore(t *testing.T) {
t.Logf("restoring backup #%v\n", i)

incrFrom := i - 1
if i == 2 {
incrFrom = 0
}
require.NoError(t, hc.Restore(c, dgraphtest.DefaultBackupDir, "", incrFrom, i, ""))
require.NoError(t, dgraphtest.WaitForRestore(c))

Expand Down
2 changes: 1 addition & 1 deletion worker/online_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func handleRestoreProposal(ctx context.Context, req *pb.RestoreRequest, pidx uin
}

if req.IncrementalFrom == 1 {
return errors.Errorf("Incremental restore must not include full backup")
req.IncrementalFrom = 0
}

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

0 comments on commit 88c4524

Please sign in to comment.