Skip to content

Commit

Permalink
chore(restore): Add more logs for restore request (#8050)
Browse files Browse the repository at this point in the history
Add more logs for restore.
  • Loading branch information
ahsanbarkati committed Sep 23, 2021
1 parent ccca737 commit 3950c8f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions graphql/admin/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"sync"

"github.com/dgraph-io/dgraph/edgraph"
"github.com/golang/glog"

"github.com/dgraph-io/dgraph/graphql/resolve"
"github.com/dgraph-io/dgraph/graphql/schema"
Expand Down Expand Up @@ -54,6 +55,9 @@ func resolveRestore(ctx context.Context, m schema.Mutation) (*resolve.Resolved,
if err != nil {
return resolve.EmptyResult(m, err), false
}
glog.Infof("Got restore request with location: %s, id: %s, num: %d, incrementalFrom: %d,"+
"isPartial: %v", input.Location, input.BackupId, input.BackupNum, input.IncrementalFrom,
input.IsPartial)

req := pb.RestoreRequest{
Location: input.Location,
Expand Down
6 changes: 5 additions & 1 deletion worker/online_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,10 @@ func tryRestoreProposal(ctx context.Context, req *pb.RestoreRequest) error {
for i := 0; i < 10; i++ {
err = proposeRestoreOrSend(ctx, req)
if err == nil {
glog.Info("proposeRestoreOrSend done.")
return nil
}

glog.Errorf("Got error while proposeRestoreOrSend: %v, will retry...\n", err)
if retriableRestoreError(err) {
time.Sleep(time.Second)
continue
Expand All @@ -256,6 +257,7 @@ func (w *grpcWorker) Restore(ctx context.Context, req *pb.RestoreRequest) (*pb.S
return nil, errors.Wrapf(err, "cannot wait for restore ts %d", req.RestoreTs)
}

glog.Infof("Proposing restore request")
err := groups().Node.proposeAndWait(ctx, &pb.Proposal{Restore: req})
if err != nil {
return &emptyRes, errors.Wrapf(err, errRestoreProposal)
Expand Down Expand Up @@ -424,12 +426,14 @@ func handleRestoreProposal(ctx context.Context, req *pb.RestoreRequest, pidx uin
go func(idx uint64) {
n := groups().Node
if !n.AmLeader() {
glog.Infof("I am not leader, not proposing snapshot.")
return
}
if err := n.Applied.WaitForMark(context.Background(), idx); err != nil {
glog.Errorf("Error waiting for mark for index %d: %+v", idx, err)
return
}
glog.Infof("I am the leader. Proposing snapshot after restore.")
if err := n.proposeSnapshot(); err != nil {
glog.Errorf("cannot propose snapshot after processing restore proposal %+v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion worker/restore_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,8 @@ func RunMapper(req *pb.RestoreRequest, mapDir string) (*mapResult, error) {
}
maxBannedNs = x.Max(maxBannedNs, ns)
}
glog.Infof("[MAP] Processed manifest %d\n", manifest.BackupNum)
}
glog.Infof("[MAP] Processed manifest num: %d\n", manifest.BackupNum)
} // done with all the manifests.

glog.Infof("Histogram of map input sizes:\n%s\n", mapper.szHist)
Expand Down

0 comments on commit 3950c8f

Please sign in to comment.