Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(restore): allow incrementalFrom to be 1 in restore API #8988

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 7 additions & 1 deletion worker/online_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,14 @@ func handleRestoreProposal(ctx context.Context, req *pb.RestoreRequest, pidx uin
return errors.Errorf("nil restore request")
}

// 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.
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