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
  • Loading branch information
mangalaman93 committed Aug 25, 2023
1 parent 666cf04 commit 21f1548
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions graphql/admin/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func resolveRestore(ctx context.Context, m schema.Mutation) (*resolve.Resolved,
if err != nil {
return resolve.EmptyResult(m, err), false
}
glog.Infof("Got restore request, location: %v, backupId: %v, backupNum: %v, 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 @@ -204,9 +204,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, retrying!", err)
if retriableRestoreError(err) {
time.Sleep(time.Second)
continue
Expand All @@ -229,6 +230,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 @@ -415,12 +417,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 @@ -799,8 +799,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: %v", 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 21f1548

Please sign in to comment.