Skip to content

Commit 1154923

Browse files
committed
parallel run for all states
1 parent 733c741 commit 1154923

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

core/state/state_sizer.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,14 @@ func (t *SizeTracker) build(root common.Hash, blockNumber uint64, done chan buil
440440

441441
// Start all table iterations concurrently with direct metric updates
442442
group.Go(func() error {
443-
count, bytes, err := t.iterateTable(t.abort, rawdb.SnapshotAccountPrefix, "account")
443+
count, bytes, err := t.iterateTableParallel(t.abort, rawdb.SnapshotAccountPrefix, "account")
444444
if err != nil {
445445
return err
446446
}
447447
accounts, accountBytes = count, bytes
448448
return nil
449449
})
450450

451-
// Storage table is huge, iterate in parallel
452451
group.Go(func() error {
453452
count, bytes, err := t.iterateTableParallel(t.abort, rawdb.SnapshotStoragePrefix, "storage")
454453
if err != nil {
@@ -459,15 +458,14 @@ func (t *SizeTracker) build(root common.Hash, blockNumber uint64, done chan buil
459458
})
460459

461460
group.Go(func() error {
462-
count, bytes, err := t.iterateTable(t.abort, rawdb.TrieNodeAccountPrefix, "accountnode")
461+
count, bytes, err := t.iterateTableParallel(t.abort, rawdb.TrieNodeAccountPrefix, "accountnode")
463462
if err != nil {
464463
return err
465464
}
466465
accountTrienodes, accountTrienodeBytes = count, bytes
467466
return nil
468467
})
469468

470-
// Storage trienode table is huge, iterate in parallel
471469
group.Go(func() error {
472470
count, bytes, err := t.iterateTableParallel(t.abort, rawdb.TrieNodeStoragePrefix, "storagenode")
473471
if err != nil {
@@ -582,7 +580,7 @@ func (t *SizeTracker) iterateTableParallel(closed chan struct{}, prefix []byte,
582580
for i := 0; i < 256; i++ {
583581
h := byte(i)
584582
group.Go(func() error {
585-
count, bytes, err := t.iterateTable(closed, slices.Concat(prefix, []byte{h}), fmt.Sprintf("%s-%x", name, h))
583+
count, bytes, err := t.iterateTable(closed, slices.Concat(prefix, []byte{h}), fmt.Sprintf("%s-%02x", name, h))
586584
if err != nil {
587585
return err
588586
}

0 commit comments

Comments
 (0)