[#1869] shard: Restore shard mode on failed reloads

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-10-16 16:11:29 +03:00 committed by fyrchik
parent c785e11b20
commit 87be4f1629
3 changed files with 22 additions and 4 deletions

View file

@ -171,7 +171,7 @@ func (db *DB) Reload(opts ...Option) (bool, error) {
db.modeMtx.Lock()
defer db.modeMtx.Unlock()
if c.info.Path != "" && filepath.Clean(db.info.Path) != filepath.Clean(c.info.Path) {
if db.mode.NoMetabase() || c.info.Path != "" && filepath.Clean(db.info.Path) != filepath.Clean(c.info.Path) {
if err := db.Close(); err != nil {
return false, err
}