eth, triedb/pathdb: permit write buffer allowance in PBSS archive mode

This commit is contained in:
Gary Rong 2025-06-25 09:47:49 +08:00
parent 6dd38d239d
commit 71247ffdee
2 changed files with 9 additions and 7 deletions

View file

@ -140,7 +140,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice) log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice)
config.Miner.GasPrice = new(big.Int).Set(ethconfig.Defaults.Miner.GasPrice) config.Miner.GasPrice = new(big.Int).Set(ethconfig.Defaults.Miner.GasPrice)
} }
if config.NoPruning && config.TrieDirtyCache > 0 { if config.NoPruning && config.TrieDirtyCache > 0 && config.StateScheme == rawdb.HashScheme {
if config.SnapshotCache > 0 { if config.SnapshotCache > 0 {
config.TrieCleanCache += config.TrieDirtyCache * 3 / 5 config.TrieCleanCache += config.TrieDirtyCache * 3 / 5
config.SnapshotCache += config.TrieDirtyCache * 2 / 5 config.SnapshotCache += config.TrieDirtyCache * 2 / 5

View file

@ -224,9 +224,10 @@ func (b *batchIndexer) finish(force bool) error {
// indexSingle processes the state history with the specified ID for indexing. // indexSingle processes the state history with the specified ID for indexing.
func indexSingle(historyID uint64, db ethdb.KeyValueStore, freezer ethdb.AncientReader) error { func indexSingle(historyID uint64, db ethdb.KeyValueStore, freezer ethdb.AncientReader) error {
defer func(start time.Time) { start := time.Now()
defer func() {
indexHistoryTimer.UpdateSince(start) indexHistoryTimer.UpdateSince(start)
}(time.Now()) }()
metadata := loadIndexMetadata(db) metadata := loadIndexMetadata(db)
if metadata == nil || metadata.Last+1 != historyID { if metadata == nil || metadata.Last+1 != historyID {
@ -247,15 +248,16 @@ func indexSingle(historyID uint64, db ethdb.KeyValueStore, freezer ethdb.Ancient
if err := b.finish(true); err != nil { if err := b.finish(true); err != nil {
return err return err
} }
log.Debug("Indexed state history", "id", historyID) log.Info("Indexed state history", "id", historyID, "elapsed", common.PrettyDuration(time.Since(start)))
return nil return nil
} }
// unindexSingle processes the state history with the specified ID for unindexing. // unindexSingle processes the state history with the specified ID for unindexing.
func unindexSingle(historyID uint64, db ethdb.KeyValueStore, freezer ethdb.AncientReader) error { func unindexSingle(historyID uint64, db ethdb.KeyValueStore, freezer ethdb.AncientReader) error {
defer func(start time.Time) { start := time.Now()
defer func() {
unindexHistoryTimer.UpdateSince(start) unindexHistoryTimer.UpdateSince(start)
}(time.Now()) }()
metadata := loadIndexMetadata(db) metadata := loadIndexMetadata(db)
if metadata == nil || metadata.Last != historyID { if metadata == nil || metadata.Last != historyID {
@ -276,7 +278,7 @@ func unindexSingle(historyID uint64, db ethdb.KeyValueStore, freezer ethdb.Ancie
if err := b.finish(true); err != nil { if err := b.finish(true); err != nil {
return err return err
} }
log.Debug("Unindexed state history", "id", historyID) log.Debug("Unindexed state history", "id", historyID, "elapsed", common.PrettyDuration(time.Since(start)))
return nil return nil
} }