iavl
iavl copied to clipboard
Lazy Pruning
Background
Currently, the pruning process in IAVL is synchronous and blocks the Commit flow, leading to performance bottlenecks, especially when pruning legacy orphaned nodes in v1.
Proposal
Implement lazy pruning in IAVL v1 to make the process asynchronous and improve performance. Lazy pruning will separate the pruning operation from the main SaveVersion flow, allowing it to run independently and not block the Commit flow.
Plan
- Run the internal pruning loop process.
- Store the version in the
Prunefunction to let the internal pruning process know about the up-to-date version. It allows to not break the current interface. - Setup the channel between
SaveVersionand the internal pruning process to allow blocking the pruning process inSaveVersion.
Nice! To be clear for those reading, by "lazy" we mean deferred execution.
Would really appreciate us doing this!
completed