Skip to content

Commit

Permalink
fix: skip node buffer count check when recovering
Browse files Browse the repository at this point in the history
  • Loading branch information
VM committed Jan 10, 2025
1 parent 1f6aea3 commit c944d3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
"github.com/ethereum/go-ethereum/core/state/pruner"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/txpool/blobpool"
"github.com/ethereum/go-ethereum/core/txpool/bundlepool"
"github.com/ethereum/go-ethereum/core/txpool/legacypool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
Expand Down
14 changes: 8 additions & 6 deletions triedb/pathdb/nodebufferlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (nf *nodebufferlist) recoverNodeBufferList(freezer *rawdb.ResettableFreezer
nf.size += current.size
nf.layers += current.layers
}
nf.diffToBase()
nf.diffToBase(true)
nf.backgroundFlush()

log.Info("Succeed to recover node buffer list", "base_size", nf.base.size, "tail_state_id", nf.tail.id,
Expand Down Expand Up @@ -676,15 +676,17 @@ func (nf *nodebufferlist) traverseReverse(cb func(*multiDifflayer) bool) {
// diffToBase calls traverseReverse and merges the multiDifflayer's nodes to
// base node buffer, if up to limit size and flush to disk. It is called
// periodically in the background
func (nf *nodebufferlist) diffToBase() {
func (nf *nodebufferlist) diffToBase(skipCountCheck bool) {
commitFunc := func(buffer *multiDifflayer) bool {
if nf.base.size >= nf.base.limit {
log.Debug("base node buffer need write disk immediately")
return false
}
if nf.count <= nf.rsevMdNum {
log.Debug("node buffer list less, waiting more difflayer to be committed")
return false
if !skipCountCheck {
if nf.count <= nf.rsevMdNum {
log.Debug("node buffer list less, waiting more difflayer to be committed")
return false
}
}
if buffer.block%nf.dlInMd != 0 {
log.Crit("committed block number misaligned", "block", buffer.block)
Expand Down Expand Up @@ -804,7 +806,7 @@ func (nf *nodebufferlist) loop() {
if nf.isFlushing.Swap(true) {
continue
}
nf.diffToBase()
nf.diffToBase(false)
if nf.base.size >= nf.base.limit {
nf.backgroundFlush()
}
Expand Down

0 comments on commit c944d3c

Please sign in to comment.