Patch for concurrent iterator & others (onto v1.11.6) #386

Closed
roysc wants to merge 1565 commits from v1.11.6-statediff-v5 into master
Showing only changes of commit 57a65f00c9 - Show all commits

View File

@ -662,8 +662,9 @@ func (db *Database) Commit(node common.Hash, report bool, callback func(common.H
// Uncache any leftovers in the last batch // Uncache any leftovers in the last batch
db.lock.Lock() db.lock.Lock()
defer db.lock.Unlock() defer db.lock.Unlock()
if err := batch.Replay(uncacher); err != nil {
batch.Replay(uncacher) return err
}
batch.Reset() batch.Reset()
// Reset the storage counters and bumped metrics // Reset the storage counters and bumped metrics
@ -711,9 +712,12 @@ func (db *Database) commit(hash common.Hash, batch ethdb.Batch, uncacher *cleane
return err return err
} }
db.lock.Lock() db.lock.Lock()
batch.Replay(uncacher) err := batch.Replay(uncacher)
batch.Reset() batch.Reset()
db.lock.Unlock() db.lock.Unlock()
if err != nil {
return err
}
} }
return nil return nil
} }