frostfs-node/pkg/local_object_storage
Leonard Lyubich a1696a81b6 [#776] writecache: Limit size of used disk space
There is a need to limit disk space used by write-cache. It is almost
impossible to calculate the value exactly. It is proposed to estimate the
size of the cache by the number of objects stored in it.

Track amounts of objects saved in DB and FSTree separately. To do this,
`ObjectCounters` interface is defined. It is generalized to a store of
numbers that can be made persistent (new option `WithObjectCounters`). By
default DB number is calculated as key number in default bucket, and FS
number is set same to DB since it is currently hard to read the actual value
from `FSTree` instance. Each PUT/DELETE operation to DB or FS
increases/decreases corresponding counter. Before each PUT op an overflow
check is performed with the following formula for evaluating the occupied
space: `NumDB * MaxDBSize + NumFS * MaxFSSize`. If next PUT can cause
write-cache overflow, object is written to the main storage.

By default maximum write-cache size is set to 1GB.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-15 18:07:36 +03:00
..
blobovnicza [#727] Use `util.MkdirAllX` instead of `os.MkdirAll` 2021-07-30 16:42:22 +03:00
blobstor [#790] blobstor: Log each writing operation 2021-09-13 15:02:13 +03:00
engine [#766] Fix makezero linter error 2021-08-26 17:57:15 +03:00
internal/log [#790] storage engine: Add common template of log messages 2021-09-13 15:02:13 +03:00
metabase [#760] metabase: Support `COMMON_PREFIX` matchtype 2021-08-27 15:03:15 +03:00
shard [#762] storage/shard: Try to read headers from write-cache 2021-09-02 11:33:17 +03:00
util [#477] metabase: Move `MergeSplitInfo` to storage/util pkg 2021-04-15 11:18:39 +03:00
writecache [#776] writecache: Limit size of used disk space 2021-09-15 18:07:36 +03:00