reth icon indicating copy to clipboard operation
reth copied to clipboard

segment ring for fair pruning

Open emhane opened this issue 11 months ago • 1 comments

Describe the feature

Segment pruning always starts with the same segment. Last segments in the iterator, risk not being pruned if the prune limit is small so it's often reached before pruning is done. We should implement a ring here: add a field to Pruner where we save the index in the chained segments iterator, of the last pruned segment. Upon calling prune_segments next time, the iterator should skip until the saved index + 1.

https://github.com/paradigmxyz/reth/blob/c04dbe6e9bd05be5da3a5d541adbf76166c14a08/crates/prune/src/pruner.rs#L141-L145

This will probably require modifying static_file_segments method, since it's important that no segments that need pruning are dropped when the iterator skips ahead to the last pruned segment.

https://github.com/paradigmxyz/reth/blob/c04dbe6e9bd05be5da3a5d541adbf76166c14a08/crates/prune/src/pruner.rs#L215-L243

Additional context

No response

emhane avatar Mar 26 '24 20:03 emhane

This issue is stale because it has been open for 21 days with no activity.

github-actions[bot] avatar Apr 17 '24 01:04 github-actions[bot]

blocked by https://github.com/paradigmxyz/reth/issues/8746

emhane avatar Jul 03 '24 12:07 emhane