Fix Badger writecache race #765

Merged
fyrchik merged 1 commits from dstepanov-yadro/frostfs-node:fix/wc_badger_race into master 2023-10-31 10:01:28 +00:00

Closes #728

Closes #728
dstepanov-yadro requested review from storage-core-committers 2023-10-30 14:32:05 +00:00
dstepanov-yadro requested review from storage-core-developers 2023-10-30 14:32:06 +00:00
fyrchik approved these changes 2023-10-30 14:38:07 +00:00
@ -85,6 +85,9 @@ func (c *cache) DumpInfo() writecache.Info {
// Open opens and initializes database. Reads object counters from the ObjectCounters instance.
func (c *cache) Open(_ context.Context, readOnly bool) error {
c.modeMtx.Lock()

There we races in SetMode, is it fixed with this?

There we races in `SetMode`, is it fixed with this?
Poster
Collaborator

Hm, SetMode is already protected by mutex.

WARNING: DATA RACE
Write at 0x00c0001a2378 by goroutine 861:
  git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/writecachebadger.(*cache).openStore()
      /workspace/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/writecachebadger/storage.go:53 +0x145

Previous read at 0x00c0001a2378 by goroutine 1244:
  git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/writecachebadger.(*cache).runGCLoop.func1()
      /workspace/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/writecachebadger/gc.go:33 +0x2a8

I've missed fix for GC, so now it's ok.

Hm, `SetMode` is already protected by mutex. ``` WARNING: DATA RACE Write at 0x00c0001a2378 by goroutine 861: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/writecachebadger.(*cache).openStore() /workspace/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/writecachebadger/storage.go:53 +0x145 Previous read at 0x00c0001a2378 by goroutine 1244: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/writecachebadger.(*cache).runGCLoop.func1() /workspace/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/writecachebadger/gc.go:33 +0x2a8 ``` I've missed fix for GC, so now it's ok.
dstepanov-yadro force-pushed fix/wc_badger_race from eac7541162 to 869518be0a 2023-10-30 15:38:40 +00:00 Compare
acid-ant approved these changes 2023-10-31 06:27:50 +00:00
fyrchik changed title from Fix Badger writecache race. to Fix Badger writecache race 2023-10-31 09:18:17 +00:00
fyrchik merged commit 869518be0a into master 2023-10-31 10:01:28 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#765
There is no content yet.