mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 08:23:50 +01:00
snapper: make error mode an error wait mode
Just because taking one snapshot fails does not mean snapper needs to stop for all others. Since users are advised to monitor error logs, snapshot-taking errors can still be addressed. The ErrorWait mode allows a potential future Report / Status command to distinguish normal waits from error waits.
This commit is contained in:
parent
d04b9713c4
commit
4e04f8d3d2
@ -74,7 +74,7 @@ const (
|
||||
Planning
|
||||
Snapshotting
|
||||
Waiting
|
||||
Error
|
||||
ErrorWait
|
||||
)
|
||||
|
||||
func (s State) sf() state {
|
||||
@ -83,7 +83,7 @@ func (s State) sf() state {
|
||||
Planning: plan,
|
||||
Snapshotting: snapshot,
|
||||
Waiting: wait,
|
||||
Error: nil,
|
||||
ErrorWait: wait,
|
||||
}
|
||||
return m[s]
|
||||
}
|
||||
@ -163,7 +163,7 @@ func (s *Snapper) Run(ctx context.Context, snapshotsTaken chan<- struct{}) {
|
||||
func onErr(err error, u updater) state {
|
||||
return u(func(s *Snapper) {
|
||||
s.err = err
|
||||
s.state = Error
|
||||
s.state = ErrorWait
|
||||
}).sf()
|
||||
}
|
||||
|
||||
@ -254,13 +254,15 @@ func snapshot(a args, u updater) state {
|
||||
select {
|
||||
case a.snapshotsTaken <- struct{}{}:
|
||||
default:
|
||||
if a.snapshotsTaken != nil {
|
||||
a.log.Warn("callback channel is full, discarding snapshot update event")
|
||||
}
|
||||
}
|
||||
|
||||
return u(func(snapper *Snapper) {
|
||||
if hadErr {
|
||||
snapper.state = Error
|
||||
snapper.err = errors.New("one or more snapshots could not be created")
|
||||
snapper.state = ErrorWait
|
||||
snapper.err = errors.New("one or more snapshots could not be created, check logs for details")
|
||||
} else {
|
||||
snapper.state = Waiting
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ const (
|
||||
_State_name_0 = "SyncUpPlanning"
|
||||
_State_name_1 = "Snapshotting"
|
||||
_State_name_2 = "Waiting"
|
||||
_State_name_3 = "Error"
|
||||
_State_name_3 = "ErrorWait"
|
||||
)
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user