Skip to content

PBM-1574 PBM restore with -w doesn't wait till the end of restore #1169

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

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
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
25 changes: 14 additions & 11 deletions pbm/restore/physical.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,15 +1076,24 @@ func (r *PhysRestore) Snapshot(
}

var progress nodeStatus
var finalStat defs.Status
defer func() {
if err != nil && !errors.Is(err, ErrNoDataForShard) {
r.MarkFailed(err)
}

noerr := err == nil
err = r.close(noerr, progress)
if err != nil {
err = errors.Wrap(err, "snapshot close")
cerr := r.close(noerr, progress)

if cerr != nil && err == nil {
err = errors.Wrap(cerr, "snapshot close")
}

if noerr && err == nil {
r.log.Info("writing restore meta")
if derr := r.dumpMeta(meta, finalStat, ""); derr != nil {
r.log.Warning("writing restore meta to storage: %v", derr)
}
}
}()

Expand Down Expand Up @@ -1299,12 +1308,12 @@ func (r *PhysRestore) Snapshot(
// next.
progress |= restoreDone

stat, err := r.toState(defs.StatusDone)
finalStat, err = r.toState(defs.StatusDone)
if err != nil {
if r.nodeInfo.IsLeader() {
// before returning try to create meta
r.log.Info("writing restore meta")
merr := r.dumpMeta(meta, stat, "")
merr := r.dumpMeta(meta, finalStat, "")
if merr != nil {
r.log.Warning("writing restore meta to storage: %v", merr)
}
Expand All @@ -1317,12 +1326,6 @@ func (r *PhysRestore) Snapshot(
r.log.Warning("write download stat: %v", err)
}

r.log.Info("writing restore meta")
err = r.dumpMeta(meta, stat, "")
if err != nil {
return errors.Wrap(err, "writing restore meta to storage")
}

return nil
}

Expand Down
Loading