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 Prune function 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 SaveVersion and the internal pruning process to allow blocking the pruning process in SaveVersion.
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 mainSaveVersion
flow, allowing it to run independently and not block theCommit
flow.Plan
Prune
function to let the internal pruning process know about the up-to-date version. It allows to not break the current interface.SaveVersion
and the internal pruning process to allow blocking the pruning process inSaveVersion
.