frostfs-node/pkg/local_object_storage/writecache
Aleksey Savchuk f3c141de41
Some checks failed
DCO action / DCO (pull_request) Failing after 34s
Vulncheck / Vulncheck (pull_request) Successful in 1m0s
Build / Build Components (pull_request) Successful in 1m30s
Tests and linters / Run gofumpt (pull_request) Successful in 1m22s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m40s
Tests and linters / Staticcheck (pull_request) Successful in 2m30s
Tests and linters / Tests (pull_request) Successful in 2m33s
Tests and linters / gopls check (pull_request) Successful in 2m54s
Tests and linters / Tests with -race (pull_request) Successful in 3m9s
Tests and linters / Lint (pull_request) Successful in 3m26s
[#xx] writecache: Fix race condition when reporting cache size metrics
There is a race condition when multiple cache operation try to report
the cache size metrics simultaneously. Consider the following example:
- the initial total size of objects stored in the cache size is 2
- worker X deletes an object and reads the cache size, which is 1
- worker Y deletes an object and reads the cache size, which is 0
- worker Y reports the cache size it learnt, which is 0
- worker X reports the cache size it learnt, which is 1

As a result, the observed cache size is 1 (i. e. one object remains
in the cache), which is incorrect because the actual cache size is 0.

To fix this, a separate worker for reporting the cache size metric has
been created. All operations should use a queue (a buffered channel) to
request the reporter worker to report the metrics. Currently, all queue
writes are non-blocking.

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2025-02-18 13:06:55 +03:00
..
benchmark [#1437] node: Fix contextcheck linter 2024-11-13 10:36:10 +03:00
cache.go [#xx] writecache: Fix race condition when reporting cache size metrics 2025-02-18 13:06:55 +03:00
delete.go [#1437] node: Use ctx for logging 2024-11-13 10:36:07 +03:00
flush.go [#1608] writecache: Add IO tag to flush worker 2025-02-07 15:43:06 +03:00
flush_test.go [#1437] node: Fix contextcheck linter 2024-11-13 10:36:10 +03:00
generic_test.go [#895] test: Fix NewLogger arguments list 2024-01-11 12:32:09 +00:00
get.go [#1367] writecache: Drop bbolt DB 2024-09-12 14:22:29 +03:00
iterate.go [#1568] storage: Remove "could not/can't/failed to" from error messages 2024-12-18 15:52:26 +00:00
limiter.go [#1367] writecache: Add background flushing objects limiter 2024-09-12 15:06:33 +03:00
limiter_test.go [#1459] .golangci.yml: Add intrange linter, fix issues 2024-10-30 15:18:22 +00:00
metrics.go [#xx] writecache: Fix race condition when reporting cache size metrics 2025-02-18 13:06:55 +03:00
mode.go [#1568] storage: Remove "could not/can't/failed to" from error messages 2024-12-18 15:52:26 +00:00
mode_test.go [#1437] node: Fix contextcheck linter 2024-11-13 10:36:10 +03:00
options.go [#1437] node: Fix contextcheck linter 2024-11-13 10:36:10 +03:00
put.go [#1437] node: Use ctx for logging 2024-11-13 10:36:07 +03:00
seal.go [#1298] writecache: Add shrink flag for Seal command 2024-08-08 16:32:29 +03:00
state.go [#xx] writecache: Fix race condition when reporting cache size metrics 2025-02-18 13:06:55 +03:00
storage.go [#1568] storage: Remove "could not/can't/failed to" from error messages 2024-12-18 15:52:26 +00:00
upgrade.go [#1568] storage: Remove "could not/can't/failed to" from error messages 2024-12-18 15:52:26 +00:00
writecache.go [#1437] node: Fix contextcheck linter 2024-11-13 10:36:10 +03:00