Skip to content

Commit

Permalink
Enable draining mode when doing an online restore. (hypermodeinc#5265)
Browse files Browse the repository at this point in the history
While doing an online restore, queries and mutations should be
disallowed.
  • Loading branch information
martinmr authored and dna2github committed Jul 18, 2020
1 parent 485f529 commit 504e36c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions worker/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ func (n *node) applyCommitted(proposal *pb.Proposal) error {
return nil

case proposal.Restore != nil:
// Enable draining mode for the duration of the restore processing.
x.UpdateDrainingMode(true)
defer x.UpdateDrainingMode(false)

if err := handleRestoreProposal(ctx, proposal.Restore); err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion worker/online_restore_ee.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ func (w *grpcWorker) Restore(ctx context.Context, req *pb.RestoreRequest) (*pb.S

// TODO(DGRAPH-1220): Online restores support passing the backup id.
// TODO(DGRAPH-1230): Track restore operations.
// TODO(DGRAPH-1231): Use draining mode during restores.
// TODO(DGRAPH-1232): Ensure all groups receive the restore proposal.
func handleRestoreProposal(ctx context.Context, req *pb.RestoreRequest) error {
if req == nil {
Expand Down

0 comments on commit 504e36c

Please sign in to comment.