Skip to content

Commit

Permalink
fix: fix minItems
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjunLi committed Aug 20, 2024
1 parent 5d19f21 commit 217b64e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions core/rawdb/prunedfreezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func newPrunedFreezer(datadir string, db ethdb.KeyValueStore, offset uint64) (*p

// repair init frozen , compatible disk-ancientdb and pruner-block-tool.
func (f *prunedfreezer) repair(datadir string) error {
offset := atomic.LoadUint64(&f.frozen)
// compatible freezer
minItems := uint64(math.MaxUint64)
for name, disableSnappy := range chainFreezerNoSnappy {
Expand Down Expand Up @@ -96,14 +97,8 @@ func (f *prunedfreezer) repair(datadir string) error {
table.Close()
}

// If minItems is non-zero, it indicates that the chain freezer was previously enabled, and we should use minItems as the current frozen value.
// If minItems is zero, it indicates that the pruneAncient was previously enabled, and we should continue using frozen
// (retrieved from CurrentAncientFreezer) as the current frozen value.
offset := minItems
if offset == 0 {
// no item in ancientDB, init `offset` to the `f.frozen`
offset = atomic.LoadUint64(&f.frozen)
}
// minItems is the value relative to offset
offset += minItems
log.Info("Read ancientdb item counts", "items", minItems, "offset", offset)

// FrozenOfAncientFreezer is the progress of the last prune-freezer freeze.
Expand Down

0 comments on commit 217b64e

Please sign in to comment.