@@ -133,9 +133,9 @@ impl StoreFSTPool {
133
133
// certain heavy tasks, which is better to spread out consolidation steps over time over \
134
134
// a large number of very active buckets.
135
135
136
- // Acquire access lock , and reference it in context
137
- // Notice: access lock lets the consolidate process wait that any thread using the graph \
138
- // is done with work , while the rebuild lock prevents 2 consolidate operations to be \
136
+ // Acquire rebuild + access locks , and reference them in context
137
+ // Notice: access lock prevents the consolidate process from using the graph if it is \
138
+ // ongoing erasure , while the rebuild lock prevents two consolidate operations to be \
139
139
// executed at the same time.
140
140
let ( _access, _rebuild) = (
141
141
GRAPH_ACCESS_LOCK . read ( ) . unwrap ( ) ,
@@ -144,6 +144,8 @@ impl StoreFSTPool {
144
144
145
145
let ( mut count_moved, mut count_pushed, mut count_popped) = ( 0 , 0 , 0 ) ;
146
146
147
+ // Notice: we need to consume the lock from there rather than assign its guard to a \
148
+ // variable as to avoid a deadlock when there are stores to clean.
147
149
if GRAPH_CONSOLIDATE . read ( ) . unwrap ( ) . len ( ) > 0 {
148
150
// Prepare close stack (used once whole set is scanned)
149
151
let mut close_stack: Vec < StoreFSTKey > = Vec :: new ( ) ;
0 commit comments