Skip to content

Commit 3950c8f

Browse files
authored
chore(restore): Add more logs for restore request (#8050)
Add more logs for restore.
1 parent ccca737 commit 3950c8f

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

graphql/admin/restore.go

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"sync"
2323

2424
"github.com/dgraph-io/dgraph/edgraph"
25+
"github.com/golang/glog"
2526

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

5862
req := pb.RestoreRequest{
5963
Location: input.Location,

worker/online_restore.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,10 @@ func tryRestoreProposal(ctx context.Context, req *pb.RestoreRequest) error {
231231
for i := 0; i < 10; i++ {
232232
err = proposeRestoreOrSend(ctx, req)
233233
if err == nil {
234+
glog.Info("proposeRestoreOrSend done.")
234235
return nil
235236
}
236-
237+
glog.Errorf("Got error while proposeRestoreOrSend: %v, will retry...\n", err)
237238
if retriableRestoreError(err) {
238239
time.Sleep(time.Second)
239240
continue
@@ -256,6 +257,7 @@ func (w *grpcWorker) Restore(ctx context.Context, req *pb.RestoreRequest) (*pb.S
256257
return nil, errors.Wrapf(err, "cannot wait for restore ts %d", req.RestoreTs)
257258
}
258259

260+
glog.Infof("Proposing restore request")
259261
err := groups().Node.proposeAndWait(ctx, &pb.Proposal{Restore: req})
260262
if err != nil {
261263
return &emptyRes, errors.Wrapf(err, errRestoreProposal)
@@ -424,12 +426,14 @@ func handleRestoreProposal(ctx context.Context, req *pb.RestoreRequest, pidx uin
424426
go func(idx uint64) {
425427
n := groups().Node
426428
if !n.AmLeader() {
429+
glog.Infof("I am not leader, not proposing snapshot.")
427430
return
428431
}
429432
if err := n.Applied.WaitForMark(context.Background(), idx); err != nil {
430433
glog.Errorf("Error waiting for mark for index %d: %+v", idx, err)
431434
return
432435
}
436+
glog.Infof("I am the leader. Proposing snapshot after restore.")
433437
if err := n.proposeSnapshot(); err != nil {
434438
glog.Errorf("cannot propose snapshot after processing restore proposal %+v", err)
435439
}

worker/restore_map.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,8 @@ func RunMapper(req *pb.RestoreRequest, mapDir string) (*mapResult, error) {
790790
}
791791
maxBannedNs = x.Max(maxBannedNs, ns)
792792
}
793-
glog.Infof("[MAP] Processed manifest %d\n", manifest.BackupNum)
794793
}
794+
glog.Infof("[MAP] Processed manifest num: %d\n", manifest.BackupNum)
795795
} // done with all the manifests.
796796

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

0 commit comments

Comments
 (0)