mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
triedb/pathdb: add more logs
This commit is contained in:
parent
71247ffdee
commit
deef42cc0c
1 changed files with 8 additions and 4 deletions
|
|
@ -130,6 +130,8 @@ func (b *batchIndexer) finish(force bool) error {
|
||||||
var (
|
var (
|
||||||
batch = b.db.NewBatch()
|
batch = b.db.NewBatch()
|
||||||
batchMu sync.RWMutex
|
batchMu sync.RWMutex
|
||||||
|
storages int
|
||||||
|
start = time.Now()
|
||||||
eg errgroup.Group
|
eg errgroup.Group
|
||||||
)
|
)
|
||||||
eg.SetLimit(runtime.NumCPU())
|
eg.SetLimit(runtime.NumCPU())
|
||||||
|
|
@ -167,6 +169,7 @@ func (b *batchIndexer) finish(force bool) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for addrHash, slots := range b.storages {
|
for addrHash, slots := range b.storages {
|
||||||
|
storages += len(slots)
|
||||||
for storageHash, idList := range slots {
|
for storageHash, idList := range slots {
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
if !b.delete {
|
if !b.delete {
|
||||||
|
|
@ -216,6 +219,7 @@ func (b *batchIndexer) finish(force bool) error {
|
||||||
if err := batch.Write(); err != nil {
|
if err := batch.Write(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Debug("Committed batch indexer", "accounts", len(b.accounts), "storages", storages, "records", b.counter, "elapsed", common.PrettyDuration(time.Since(start)))
|
||||||
b.counter = 0
|
b.counter = 0
|
||||||
b.accounts = make(map[common.Hash][]uint64)
|
b.accounts = make(map[common.Hash][]uint64)
|
||||||
b.storages = make(map[common.Hash]map[common.Hash][]uint64)
|
b.storages = make(map[common.Hash]map[common.Hash][]uint64)
|
||||||
|
|
@ -248,7 +252,7 @@ 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.Info("Indexed state history", "id", historyID, "elapsed", common.PrettyDuration(time.Since(start)))
|
log.Debug("Indexed state history", "id", historyID, "elapsed", common.PrettyDuration(time.Since(start)))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue