mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-15 16:51:03 +00:00
use the right lock for Enqueue
The request for a non-read lock blocks until all existing read locks exit, meaning that if an Immediate operation is already going for a fragment, an Enqueue operation will hang forever holding the fragment's lock, while the Immediate operation has probably relinquished the fragment's lock to wait for the queue worker to process it. But the queue worker can't process it, because the incoming Enqueue still holds the fragment's lock. Solution: Don't block the Enqueue operation like that. It shouldn't coexist with things that actually change the sq channels, like Stop(), but it is fine for it to coexist with other queue operations.
This commit is contained in:
parent
9cec40e69d
commit
bab077199c
1 changed files with 2 additions and 2 deletions
|
|
@ -200,8 +200,8 @@ func (sq *prioritySnapshotQueue) Enqueue(f *fragment) {
|
|||
if f.snapshotPending {
|
||||
return
|
||||
}
|
||||
sq.mu.Lock()
|
||||
defer sq.mu.Unlock()
|
||||
sq.mu.RLock()
|
||||
defer sq.mu.RUnlock()
|
||||
if sq.normal == nil {
|
||||
sq.logger.Printf("requested snapshot after snapshot queue was closed")
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue