Closed StephenButtolph closed 1 month ago
I'm wondering why wouldn't we compact the database inline with the block processing, i.e. within
for !haltable.Halted() && iterator.Next()
loop.
We tested that and it was less performant than this code. (for executing a single chain).
Why this should be merged
After a chain has finished bootstrapping (like the P-chain) it will re-bootstrap every 10 seconds to keep up-to-tip until the full subnet has finished bootstrapping.
Calling
db.Compact
every 10 seconds (even with a small range of impacted values on disk) significantly reduces the performance of other DB operations.This can cause the X-chain and C-chain syncing to be significantly slower than before this compaction was added.
How this works
Only compact the bootstrapping database if the number of blocks executed was significant.
How this was tested
v1.11.6
(C-chain state-sync and X-chain DAG fetching are still ongoing after >48 hours).