mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 00:13:52 +01:00
[#385] replication: report AttemptDone if no filesystems are replicated
fixes #385
This commit is contained in:
parent
bb5ef0c8b2
commit
293c89d392
@ -9,6 +9,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/kr/pretty"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -237,7 +238,7 @@ func Do(ctx context.Context, planner Planner) (ReportFunc, WaitFunc) {
|
|||||||
log.WithField("most_recent_err", mostRecentErr).WithField("most_recent_err_class", mostRecentErrClass).Debug("most recent error used for re-connect decision")
|
log.WithField("most_recent_err", mostRecentErr).WithField("most_recent_err_class", mostRecentErrClass).Debug("most recent error used for re-connect decision")
|
||||||
if mostRecentErr == nil {
|
if mostRecentErr == nil {
|
||||||
// inconsistent reporting, let's bail out
|
// inconsistent reporting, let's bail out
|
||||||
log.Warn("attempt does not report done but error report does not report errors, aborting run")
|
log.WithField("attempt_state", rep.State).Warn("attempt does not report done but error report does not report errors, aborting run")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
log.WithError(mostRecentErr.Err).Error("most recent error in this attempt")
|
log.WithError(mostRecentErr.Err).Error("most recent error in this attempt")
|
||||||
@ -311,6 +312,9 @@ func (a *attempt) doGlobalPlanning(ctx context.Context, prev *attempt) map[*fs]*
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// a.fss != nil indicates that there was no planning error (see doc comment)
|
||||||
|
a.fss = make([]*fs, 0)
|
||||||
|
|
||||||
for _, pfs := range pfss {
|
for _, pfs := range pfss {
|
||||||
fs := &fs{
|
fs := &fs{
|
||||||
fs: pfs,
|
fs: pfs,
|
||||||
@ -676,10 +680,12 @@ func (a *attempt) report() *report.AttemptReport {
|
|||||||
r.Filesystems[i] = a.fss[i].report()
|
r.Filesystems[i] = a.fss[i].report()
|
||||||
}
|
}
|
||||||
|
|
||||||
state := report.AttemptPlanning
|
var state report.AttemptState
|
||||||
if a.planErr != nil {
|
if a.planErr == nil && a.fss == nil {
|
||||||
|
state = report.AttemptPlanning
|
||||||
|
} else if a.planErr != nil && a.fss == nil {
|
||||||
state = report.AttemptPlanningError
|
state = report.AttemptPlanningError
|
||||||
} else if a.fss != nil {
|
} else if a.planErr == nil && a.fss != nil {
|
||||||
if a.finishedAt.IsZero() {
|
if a.finishedAt.IsZero() {
|
||||||
state = report.AttemptFanOutFSs
|
state = report.AttemptFanOutFSs
|
||||||
} else {
|
} else {
|
||||||
@ -692,6 +698,8 @@ func (a *attempt) report() *report.AttemptReport {
|
|||||||
state = report.AttemptFanOutError
|
state = report.AttemptFanOutError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
panic(fmt.Sprintf("attempt.planErr and attempt.fss must not both be != nil:\n%s\n%s", pretty.Sprint(a.planErr), pretty.Sprint(a.fss)))
|
||||||
}
|
}
|
||||||
r.State = state
|
r.State = state
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user