Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/store/types: ValueStore: Fix deadlocks for concurrent writes, bufferMu and NBSStore. #5273

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

reltuk
Copy link
Contributor

@reltuk reltuk commented Feb 1, 2023

At times ValueStore calls into ChunkStore.PutChunk, for example, with bufferMu held. With online-GC, that call can block until a GC process is finished. So a calling goroutine would block with bufferMu held. However, in order for the GC process to finish, ValueStore.GC needs to grab bufferMu in order to finalize its bookkeeping state after ChunkStore GC is successful.

This change allows reads to proceed against ValueStore while it waits for GC to complete by adding a condition variable which we toggle before we start GC and broadcast on after we're done.

…erMu and NBSStore.

At times ValueStore calls into ChunkStore.PutChunk, for example, with bufferMu
held. With online-GC, that call can block until a GC process is finished. So a
calling goroutine would block with bufferMu held. However, in order for the GC
process to finish, ValueStore.GC needs to grab bufferMu in order to finalize
its bookkeeping state after ChunkStore GC is successful.

This change allows reads to proceed against ValueStore while it waits for GC to
complete by adding a condition variable which we toggle before we start GC and
broadcast on after we're done.
Copy link
Contributor

@andy-wm-arthur andy-wm-arthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good

This makes me want to simplify the GC interaction between ValueStore and NBS. The ChunkStoreGarbageCollector interface was changed to take a WalkAddrs callback, we might we able to move all this state management down into NBS. Old vs new gen refs adds a wrinkle tho

@reltuk reltuk merged commit 2cd5300 into main Feb 2, 2023
@tbantle22 tbantle22 deleted the aaron/value-store-gc-locking-deadlock branch March 9, 2023 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants