From 616013cb8a5ae724cf6e423898c59416135f0ae7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 19 Oct 2021 19:22:47 +0300 Subject: [PATCH] [#933] write-cache: Use real number of objects in counters Signed-off-by: Pavel Karpy --- pkg/local_object_storage/writecache/state.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/local_object_storage/writecache/state.go b/pkg/local_object_storage/writecache/state.go index d51d1f937..2885c4331 100644 --- a/pkg/local_object_storage/writecache/state.go +++ b/pkg/local_object_storage/writecache/state.go @@ -91,9 +91,12 @@ func (x *counters) Read() error { x.cDB.Store(inDB) - // FIXME: calculate the actual value in FSTree (new method?). - // For now we can think that db/fs = 50/50. - x.cFS.Store(inDB) + inFS, err := x.fs.NumberOfObjects() + if err != nil { + return fmt.Errorf("could not read write-cache FS counter: %w", err) + } + + x.cFS.Store(inFS) return nil }