-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db-truncater: make
--truncate-after-slot
more lenient again (#1203)
Closes #1202 This PR reverts the behavioral change of #1143, specifically 5747d3c. Concretely, `--truncate-after-slot slotNo` will now remove all blocks with a slot number higher than `slotNo` in the ImmutableDB, but does not require that a block with exactly that slot number exists. This is convenient eg for truncating all blocks after an epoch without having to find out the exact slot of the last block in the epoch just before. At the same time, the run time is still much faster than before #1143: We iteratively check all slot numbers descending from the given one, and truncate to the first point that is in the ImmutableDB. As realistic ImmutableDBs are only somewhat sparse (active slot coefficient is `f = 1/20`), this should be very fast (ie still constant time in the length of the chain if we consider the slot distance between any two adjacent blocks to be bounded). In addition, we explicitly check whether the given argument is beyond the tip of the ImmutableDB, and immediately exit (successfully) in that case.
- Loading branch information
Showing
3 changed files
with
30 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters