[#1549] shard: Turn to read-only mode on metabase failure

If metabase can't be opened in the default mode, try opening shard
first in `ReadOnly` mode and then in `DegradedReadOnly`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-06-27 11:06:01 +03:00 committed by fyrchik
parent 4944490ffb
commit fabe717d32
3 changed files with 122 additions and 12 deletions

View file

@ -123,5 +123,8 @@ func (db *DB) init(reset bool) error {
// Close closes boltDB instance.
func (db *DB) Close() error {
return db.boltDB.Close()
if db.boltDB != nil {
return db.boltDB.Close()
}
return nil
}