Skip to content

Commit

Permalink
chore(restore): add docs for mutations in between incremental restore
Browse files Browse the repository at this point in the history
If we do mutations in between incremental restores, those will
get lost. The next incremental restore will overwrite any data
that is written in between two incremental restores.
  • Loading branch information
mangalaman93 committed Jul 18, 2023
1 parent a506d6d commit 129b4e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
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

0 comments on commit 129b4e8

Please sign in to comment.