all: simplify and fix database iteration with prefix/start (#20808)

* core/state/snapshot: start fixing disk iterator seek

* ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start

* les, core/state/snapshot: iterator fixes

* all: remove two iterator methods

* all: rename Iteratee.NewIteratorWith -> NewIterator

* ethdb: fix review concerns
This commit is contained in:
Martin Holst Swende
2020-04-15 13:08:53 +02:00
committed by GitHub
parent 00064ddcfb
commit 6402c42b67
24 changed files with 248 additions and 187 deletions

View File

@ -99,7 +99,7 @@ func (b *SyncBloom) init(database ethdb.Iteratee) {
// Note, this is fine, because everything inserted into leveldb by fast sync is
// also pushed into the bloom directly, so we're not missing anything when the
// iterator is swapped out for a new one.
it := database.NewIterator()
it := database.NewIterator(nil, nil)
var (
start = time.Now()
@ -116,7 +116,7 @@ func (b *SyncBloom) init(database ethdb.Iteratee) {
key := common.CopyBytes(it.Key())
it.Release()
it = database.NewIteratorWithStart(key)
it = database.NewIterator(nil, key)
log.Info("Initializing fast sync bloom", "items", b.bloom.N(), "errorrate", b.errorRate(), "elapsed", common.PrettyDuration(time.Since(start)))
swap = time.Now()