[#1869] shard: Add logs for SetMode
operations on reload
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
87be4f1629
commit
1beafea0b5
1 changed files with 3 additions and 0 deletions
|
@ -282,6 +282,7 @@ func (s *Shard) Reload(opts ...Option) error {
|
||||||
ok, err := s.metaBase.Reload(c.metaOpts...)
|
ok, err := s.metaBase.Reload(c.metaOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, meta.ErrDegradedMode) {
|
if errors.Is(err, meta.ErrDegradedMode) {
|
||||||
|
s.log.Error("can't open metabase, move to a degraded mode", zap.Error(err))
|
||||||
_ = s.setMode(mode.DegradedReadOnly)
|
_ = s.setMode(mode.DegradedReadOnly)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
@ -297,10 +298,12 @@ func (s *Shard) Reload(opts ...Option) error {
|
||||||
err = s.metaBase.Init()
|
err = s.metaBase.Init()
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
s.log.Error("can't initialize metabase, move to a degraded-read-only mode", zap.Error(err))
|
||||||
_ = s.setMode(mode.DegradedReadOnly)
|
_ = s.setMode(mode.DegradedReadOnly)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.log.Info("trying to restore read-write mode")
|
||||||
return s.setMode(mode.ReadWrite)
|
return s.setMode(mode.ReadWrite)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue