Skip to content

Commit b157c50

Browse files
Fix/missing version on prune rebuild (#6340)
* store: Fix for_prune range for nonfinal entities Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com> * graph: Fix earliest_block off-by-one calculation for pruning after copy_nonfinal_entities bounds fix Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com> --------- Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com>
1 parent 3ca739f commit b157c50

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

graph/src/components/store/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,9 @@ impl PruneRequest {
10431043
));
10441044
}
10451045

1046-
let earliest_block = latest_block - history_blocks;
1046+
// We need to add + 1 to `earliset_block` because the lower bound is inclusive
1047+
// and otherwise we would end up with `history_blocks + 1` blocks of history instead of `history_blocks`
1048+
let earliest_block = latest_block - history_blocks + 1;
10471049
let final_block = latest_block - reorg_threshold;
10481050

10491051
Ok(Self {

store/postgres/src/relational/prune.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl TablePair {
170170
let column_list = Arc::new(self.column_list());
171171

172172
// Determine the last vid that we need to copy
173-
let range = VidRange::for_prune(conn, &self.src, final_block + 1, BLOCK_NUMBER_MAX).await?;
173+
let range = VidRange::for_prune(conn, &self.src, final_block, BLOCK_NUMBER_MAX).await?;
174174
let mut batcher = VidBatcher::load(conn, &self.src.nsp, &self.src, range).await?;
175175
tracker.start_copy_nonfinal(conn, &self.src, range).await?;
176176

0 commit comments

Comments
 (0)