iavl icon indicating copy to clipboard operation
iavl copied to clipboard

Lazy Pruning

Open cool-develope opened this issue 1 year ago • 2 comments

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 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.

cool-develope avatar Feb 15 '24 21:02 cool-develope

Nice! To be clear for those reading, by "lazy" we mean deferred execution.

alexanderbez avatar Feb 16 '24 16:02 alexanderbez

Would really appreciate us doing this!

ValarDragon avatar Feb 17 '24 14:02 ValarDragon

completed

tac0turtle avatar Mar 15 '24 10:03 tac0turtle