mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +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"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"maps"
|
"maps"
|
||||||
|
"runtime"
|
||||||
"slices"
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"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) {
|
func (t *SizeTracker) iterateTableParallel(closed chan struct{}, prefix []byte, name string) (int64, int64, error) {
|
||||||
var (
|
var (
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
workers = 16
|
workers = runtime.NumCPU()
|
||||||
totalCount int64
|
totalCount int64
|
||||||
totalBytes int64
|
totalBytes int64
|
||||||
group errgroup.Group
|
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)
|
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++ {
|
for i := 0; i < 256; i++ {
|
||||||
h := byte(i)
|
h := byte(i)
|
||||||
group.Go(func() error {
|
group.Go(func() error {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue