mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-04 05:58:40 +00:00
core/state/pruner: handle batch write errors in pruning
This commit is contained in:
parent
8a0223e8da
commit
8042c83333
1 changed files with 8 additions and 2 deletions
|
|
@ -171,7 +171,10 @@ func prune(snaptree *snapshot.Tree, root common.Hash, maindb ethdb.Database, sta
|
||||||
// Recreate the iterator after every batch commit in order
|
// Recreate the iterator after every batch commit in order
|
||||||
// to allow the underlying compactor to delete the entries.
|
// to allow the underlying compactor to delete the entries.
|
||||||
if batch.ValueSize() >= ethdb.IdealBatchSize {
|
if batch.ValueSize() >= ethdb.IdealBatchSize {
|
||||||
batch.Write()
|
if err := batch.Write(); err != nil {
|
||||||
|
iter.Release()
|
||||||
|
return err
|
||||||
|
}
|
||||||
batch.Reset()
|
batch.Reset()
|
||||||
|
|
||||||
iter.Release()
|
iter.Release()
|
||||||
|
|
@ -180,7 +183,10 @@ func prune(snaptree *snapshot.Tree, root common.Hash, maindb ethdb.Database, sta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if batch.ValueSize() > 0 {
|
if batch.ValueSize() > 0 {
|
||||||
batch.Write()
|
if err := batch.Write(); err != nil {
|
||||||
|
iter.Release()
|
||||||
|
return err
|
||||||
|
}
|
||||||
batch.Reset()
|
batch.Reset()
|
||||||
}
|
}
|
||||||
iter.Release()
|
iter.Release()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue