From 0ace28e43d9e6cf736cc216eeaa8a2f8a1dca8c9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Dec 2022 14:47:14 +0300 Subject: [PATCH] [#2175] blobovniczatree: Close all non-active blobovniczas Signed-off-by: Evgenii Stratonikov --- .../blobstor/blobovniczatree/blobovnicza.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/local_object_storage/blobstor/blobovniczatree/blobovnicza.go b/pkg/local_object_storage/blobstor/blobovniczatree/blobovnicza.go index 5ab33efaf..9b9b4b8b1 100644 --- a/pkg/local_object_storage/blobstor/blobovniczatree/blobovnicza.go +++ b/pkg/local_object_storage/blobstor/blobovniczatree/blobovnicza.go @@ -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",