Skip to content

Commit

Permalink
boostrapper: compact blocks before iterating them
Browse files Browse the repository at this point in the history
  • Loading branch information
a1k0n committed May 6, 2024
1 parent 104a00a commit a68d2fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions snow/engine/snowman/bootstrap/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
batchWritePeriod = 64
iteratorReleasePeriod = 1024
logPeriod = 5 * time.Second
minBlocksToCompact = 5000
)

// getMissingBlockIDs returns the ID of the blocks that should be fetched to
Expand Down Expand Up @@ -133,6 +134,12 @@ func execute(
tree *interval.Tree,
lastAcceptedHeight uint64,
) error {

Check failure on line 136 in snow/engine/snowman/bootstrap/storage.go

View workflow job for this annotation

GitHub Actions / Lint

empty-lines: extra empty line at the start of a block (revive)

Check failure on line 136 in snow/engine/snowman/bootstrap/storage.go

View workflow job for this annotation

GitHub Actions / Lint

unnecessary leading newline (whitespace)

if tree.Len() > minBlocksToCompact {
log("compacting before iteration...")
db.Compact(nil, nil)

Check failure on line 140 in snow/engine/snowman/bootstrap/storage.go

View workflow job for this annotation

GitHub Actions / Lint

Error return value of `db.Compact` is not checked (errcheck)
}

var (
batch = db.NewBatch()
processedSinceBatchWrite uint
Expand Down

0 comments on commit a68d2fc

Please sign in to comment.