mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
fix: special case for the prefix only key
This commit is contained in:
parent
6f0f67bc6f
commit
0b13632ae2
1 changed files with 10 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"runtime"
|
||||
"slices"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -565,7 +566,7 @@ func (t *SizeTracker) iterateTable(closed chan struct{}, prefix []byte, name str
|
|||
func (t *SizeTracker) iterateTableParallel(closed chan struct{}, prefix []byte, name string) (int64, int64, error) {
|
||||
var (
|
||||
start = time.Now()
|
||||
workers = 16
|
||||
workers = runtime.NumCPU()
|
||||
totalCount int64
|
||||
totalBytes int64
|
||||
group errgroup.Group
|
||||
|
|
@ -575,6 +576,14 @@ func (t *SizeTracker) iterateTableParallel(closed chan struct{}, prefix []byte,
|
|||
|
||||
log.Info("Starting parallel state iteration", "category", name, "workers", workers)
|
||||
|
||||
if len(prefix) > 0 {
|
||||
if blob, err := t.db.Get(prefix); err == nil && len(blob) > 0 {
|
||||
// If there's a direct hit on the prefix, include it in the stats
|
||||
totalCount = 1
|
||||
totalBytes = int64(len(prefix) + len(blob))
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < 256; i++ {
|
||||
h := byte(i)
|
||||
group.Go(func() error {
|
||||
|
|
|
|||
Loading…
Reference in a new issue