Patch for concurrent iterator & others (onto v1.11.6) #386
@ -560,6 +560,12 @@ func (dl *diskLayer) generate(stats *generatorStats) {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if batch.ValueSize() > ethdb.IdealBatchSize || abort != nil {
|
if batch.ValueSize() > ethdb.IdealBatchSize || abort != nil {
|
||||||
|
if bytes.Compare(currentLocation, dl.genMarker) < 0 {
|
||||||
|
log.Error("Snapshot generator went backwards",
|
||||||
|
"currentLocation", fmt.Sprintf("%x", currentLocation),
|
||||||
|
"genMarker", fmt.Sprintf("%x", dl.genMarker))
|
||||||
|
}
|
||||||
|
|
||||||
// Flush out the batch anyway no matter it's empty or not.
|
// Flush out the batch anyway no matter it's empty or not.
|
||||||
// It's possible that all the states are recovered and the
|
// It's possible that all the states are recovered and the
|
||||||
// generation indeed makes progress.
|
// generation indeed makes progress.
|
||||||
@ -634,8 +640,14 @@ func (dl *diskLayer) generate(stats *generatorStats) {
|
|||||||
stats.storage += common.StorageSize(1 + common.HashLength + dataLen)
|
stats.storage += common.StorageSize(1 + common.HashLength + dataLen)
|
||||||
stats.accounts++
|
stats.accounts++
|
||||||
}
|
}
|
||||||
|
marker := accountHash[:]
|
||||||
|
// If the snap generation goes here after interrupted, genMarker may go backward
|
||||||
|
// when last genMarker is consisted of accountHash and storageHash
|
||||||
|
if accMarker != nil && bytes.Equal(marker, accMarker) && len(dl.genMarker) > common.HashLength {
|
||||||
|
marker = dl.genMarker[:]
|
||||||
|
}
|
||||||
// If we've exceeded our batch allowance or termination was requested, flush to disk
|
// If we've exceeded our batch allowance or termination was requested, flush to disk
|
||||||
if err := checkAndFlush(accountHash[:]); err != nil {
|
if err := checkAndFlush(marker); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// If the iterated account is the contract, create a further loop to
|
// If the iterated account is the contract, create a further loop to
|
||||||
|
Loading…
Reference in New Issue
Block a user