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

chore(restore): Add more logs for restore request #8050

Merged
merged 2 commits into from
Sep 23, 2021
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
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