Commit d102699
committed
fix(db): avoid long flush stall on restart
enable_auto_compaction() was lowering level0_stop_writes_trigger from the
bulk-load value (512) to the RocksDB default (36) on every update() call.
At DB open the bulk-load triggers are applied by DB::open, so on any restart
L0 can legitimately hold more than 36 files. When the first post-restart
update() called enable_auto_compaction(), the trigger tightening instantly
put the DB into pre-flush stall territory, and the end-of-batch
db.flush() that follows parked inside WaitUntilFlushWouldNotStallWrites
waiting for background compaction to bring L0 below 36.
On production testnet this reliably cost 77 minutes of indexer freeze per
restart (verified by 'Manual flush start' → 'Manual flush finished' in the
RocksDB LOG). The actual memtable flush took 62 ms once unblocked; the rest
was wait.
Split enable_auto_compaction() into the minimal flag-flip and a new
apply_steady_state_triggers() that holds the L0 trigger / pending-bytes-
limit reset. Invoke the latter exactly once per DB lifetime, inside the
F-sentinel gate in start_auto_compactions(), immediately after
full_compaction() has drained L0. On DBs where F is already set (steady-
state restart), triggers stay at bulk-load values — the comment in
DB::open already argues that configuration is fine for steady-state reads
given the prefix bloom filters.1 parent ccdb399 commit d102699
2 files changed
Lines changed: 30 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
213 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
214 | 231 | | |
215 | 232 | | |
216 | 233 | | |
217 | 234 | | |
218 | | - | |
219 | 235 | | |
220 | 236 | | |
221 | 237 | | |
222 | | - | |
223 | | - | |
| 238 | + | |
| 239 | + | |
224 | 240 | | |
225 | 241 | | |
226 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
289 | 295 | | |
290 | 296 | | |
291 | 297 | | |
| |||
0 commit comments