mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 08:23:50 +01:00
pruner: log transitions to error state + log info to confirm pruning is done in active job
This commit is contained in:
parent
359ab2ca0c
commit
e63ac7d1bb
@ -356,6 +356,7 @@ func (j *ActiveSide) do(ctx context.Context) {
|
||||
})
|
||||
log.Info("start pruning sender")
|
||||
tasks.prunerSender.Prune()
|
||||
log.Info("finished pruning sender")
|
||||
senderCancel()
|
||||
}
|
||||
{
|
||||
@ -371,6 +372,7 @@ func (j *ActiveSide) do(ctx context.Context) {
|
||||
})
|
||||
log.Info("start pruning receiver")
|
||||
tasks.prunerReceiver.Prune()
|
||||
log.Info("finished pruning receiver")
|
||||
receiverCancel()
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +203,12 @@ func (p *Pruner) prune(args args) {
|
||||
GetLogger(args.ctx).
|
||||
WithField("transition", fmt.Sprintf("%s=>%s", pre, post)).
|
||||
Debug("state transition")
|
||||
if err := p.Error(); err != nil {
|
||||
GetLogger(args.ctx).
|
||||
WithError(p.err).
|
||||
WithField("state", post.String()).
|
||||
Error("entering error state after error")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,6 +268,15 @@ func (p *Pruner) State() State {
|
||||
return p.state
|
||||
}
|
||||
|
||||
func (p *Pruner) Error() error {
|
||||
p.mtx.Lock()
|
||||
defer p.mtx.Unlock()
|
||||
if p.state & (PlanWait|ExecWait|ErrPerm) != 0 {
|
||||
return p.err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type fs struct {
|
||||
path string
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user