forked from TrueCloudLab/frostfs-node
[#2175] blobovniczatree: Close all non-active blobovniczas
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
c1cf418956
commit
0ace28e43d
1 changed files with 5 additions and 1 deletions
|
@ -98,7 +98,11 @@ func NewBlobovniczaTree(opts ...Option) (blz *Blobovniczas) {
|
|||
}
|
||||
|
||||
cache, err := simplelru.NewLRU(blz.openedCacheSize, func(key interface{}, value interface{}) {
|
||||
if _, ok := blz.active[filepath.Dir(key.(string))]; ok {
|
||||
p := key.(string)
|
||||
lvlPath := filepath.Dir(p)
|
||||
if b, ok := blz.active[lvlPath]; ok && b.ind == u64FromHexString(filepath.Base(p)) {
|
||||
// This branch is taken if we have recently updated active blobovnicza and remove
|
||||
// it from opened cache.
|
||||
return
|
||||
} else if err := value.(*blobovnicza.Blobovnicza).Close(); err != nil {
|
||||
blz.log.Error("could not close Blobovnicza",
|
||||
|
|
Loading…
Reference in a new issue