Skip to content

Commit 583d449

Browse files
dimitrovmaksimincrypto32
authored andcommitted
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 872e708 commit 583d449

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

graph/src/components/store/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,9 @@ impl PruneRequest {
10671067
));
10681068
}
10691069

1070-
let earliest_block = latest_block - history_blocks;
1070+
// We need to add + 1 to `earliset_block` because the lower bound is inclusive
1071+
// and otherwise we would end up with `history_blocks + 1` blocks of history instead of `history_blocks`
1072+
let earliest_block = latest_block - history_blocks + 1;
10711073
let final_block = latest_block - reorg_threshold;
10721074

10731075
Ok(Self {

store/postgres/src/relational/prune.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl TablePair {
163163
let column_list = self.column_list();
164164

165165
// Determine the last vid that we need to copy
166-
let range = VidRange::for_prune(conn, &self.src, final_block + 1, BLOCK_NUMBER_MAX)?;
166+
let range = VidRange::for_prune(conn, &self.src, final_block, BLOCK_NUMBER_MAX)?;
167167
let mut batcher = VidBatcher::load(conn, &self.src.nsp, &self.src, range)?;
168168
tracker.start_copy_nonfinal(conn, &self.src, range)?;
169169

0 commit comments

Comments
 (0)