forked from cerc-io/plugeth
core/state/pruner: track number of skipped items during state pruning (#28368)
This commit is contained in:
parent
ffc6a0f36e
commit
6c6982163b
@ -125,7 +125,7 @@ func prune(snaptree *snapshot.Tree, root common.Hash, maindb ethdb.Database, sta
|
|||||||
// dangling node is the state root is super low. So the dangling nodes in
|
// dangling node is the state root is super low. So the dangling nodes in
|
||||||
// theory will never ever be visited again.
|
// theory will never ever be visited again.
|
||||||
var (
|
var (
|
||||||
count int
|
skipped, count int
|
||||||
size common.StorageSize
|
size common.StorageSize
|
||||||
pstart = time.Now()
|
pstart = time.Now()
|
||||||
logged = time.Now()
|
logged = time.Now()
|
||||||
@ -149,6 +149,7 @@ func prune(snaptree *snapshot.Tree, root common.Hash, maindb ethdb.Database, sta
|
|||||||
log.Debug("Forcibly delete the middle state roots", "hash", common.BytesToHash(checkKey))
|
log.Debug("Forcibly delete the middle state roots", "hash", common.BytesToHash(checkKey))
|
||||||
} else {
|
} else {
|
||||||
if stateBloom.Contain(checkKey) {
|
if stateBloom.Contain(checkKey) {
|
||||||
|
skipped += 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +166,7 @@ func prune(snaptree *snapshot.Tree, root common.Hash, maindb ethdb.Database, sta
|
|||||||
eta = time.Duration(left/speed) * time.Millisecond
|
eta = time.Duration(left/speed) * time.Millisecond
|
||||||
}
|
}
|
||||||
if time.Since(logged) > 8*time.Second {
|
if time.Since(logged) > 8*time.Second {
|
||||||
log.Info("Pruning state data", "nodes", count, "size", size,
|
log.Info("Pruning state data", "nodes", count, "skipped", skipped, "size", size,
|
||||||
"elapsed", common.PrettyDuration(time.Since(pstart)), "eta", common.PrettyDuration(eta))
|
"elapsed", common.PrettyDuration(time.Since(pstart)), "eta", common.PrettyDuration(eta))
|
||||||
logged = time.Now()
|
logged = time.Now()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user