From 3950c8f36260a0383e5684bb39595e2d60d03cb6 Mon Sep 17 00:00:00 2001 From: Ahsan Barkati Date: Thu, 23 Sep 2021 16:19:55 +0530 Subject: [PATCH] chore(restore): Add more logs for restore request (#8050) Add more logs for restore. --- graphql/admin/restore.go | 4 ++++ worker/online_restore.go | 6 +++++- worker/restore_map.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/graphql/admin/restore.go b/graphql/admin/restore.go index 354a72d463d..3eac81e41a9 100644 --- a/graphql/admin/restore.go +++ b/graphql/admin/restore.go @@ -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" @@ -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, diff --git a/worker/online_restore.go b/worker/online_restore.go index 7c53b22ea6b..e4df6494901 100644 --- a/worker/online_restore.go +++ b/worker/online_restore.go @@ -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 @@ -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) @@ -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) } diff --git a/worker/restore_map.go b/worker/restore_map.go index cc76400cb4b..2bdd0bde6d1 100644 --- a/worker/restore_map.go +++ b/worker/restore_map.go @@ -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)