forked from TrueCloudLab/frostfs-node
[#1549] shard: Always close metabase
Make `meta.DB` to call `Close` method on `bbolt.DB` instance if it is non-nil only. Call `meta.DB.Close` in `shard.Shard.Close` anyway. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
596d877a44
commit
a6d1eefeff
2 changed files with 6 additions and 6 deletions
|
@ -114,5 +114,9 @@ func (db *DB) init(reset bool) error {
|
|||
|
||||
// Close closes boltDB instance.
|
||||
func (db *DB) Close() error {
|
||||
if db.boltDB != nil {
|
||||
return db.boltDB.Close()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -204,11 +204,7 @@ func (s *Shard) Close() error {
|
|||
components = append(components, s.writeCache)
|
||||
}
|
||||
|
||||
components = append(components, s.pilorama, s.blobStor)
|
||||
|
||||
if s.GetMode() != ModeDegraded {
|
||||
components = append(components, s.metaBase)
|
||||
}
|
||||
components = append(components, s.pilorama, s.blobStor, s.metaBase)
|
||||
|
||||
for _, component := range components {
|
||||
if err := component.Close(); err != nil {
|
||||
|
|
Loading…
Reference in a new issue