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

doc(restore): add docs for mutations in between incremental restores #8908

Merged
merged 1 commit into from
Jul 18, 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
2 changes: 1 addition & 1 deletion dgraphtest/local_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (u UpgradeStrategy) String() string {
case BackupRestore:
return "backup-restore"
case InPlace:
return "stop-start"
return "in-place"
case ExportImport:
return "export-import"
default:
Expand Down
7 changes: 7 additions & 0 deletions systest/integration2/incremental_restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,12 @@ func TestIncrementalRestore(t *testing.T) {
sort.Ints(data.Q[0].Money)
require.Equal(t, uids[j-1:i], data.Q[0].Money)
}

// Even when we do an in between mutations, it makes no difference.
// Incremental restore overwrites any data written in between.
if i == 10 {
_, err := gc.Mutate(&api.Mutation{SetNquads: []byte(`<10> <money> "4" .`), CommitNow: true})
require.NoError(t, err)
}
}
}
4 changes: 4 additions & 0 deletions worker/online_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ func handleRestoreProposal(ctx context.Context, req *pb.RestoreRequest, pidx uin
if err := pstore.DropPrefix(dropAttrs...); err != nil {
return errors.Wrap(err, "failed to reduce incremental restore map")
}
// If there are any writes done after last incremental restore on badger DB,
// the restore or incremental restore will lose that data. This happens because
// the timestamp of the in between mutations etc will be lower than the timestamp
// of this incremental restore that we may be doing now (if it is one).
if err := sw.PrepareIncremental(); err != nil {
return errors.Wrapf(err, "while preparing DB")
}
Expand Down