Skip to content

Commit

Permalink
trie: handle more batch commit errors in Database (ethereum#25674)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamandlou authored and blakehhuynh committed Oct 3, 2022
1 parent 6cc36a7 commit a0bbdd9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions trie/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,9 @@ func (db *Database) Commit(node common.Hash, report bool, callback func(common.H
// Uncache any leftovers in the last batch
db.lock.Lock()
defer db.lock.Unlock()

batch.Replay(uncacher)
if err := batch.Replay(uncacher); err != nil {
return err
}
batch.Reset()

// Reset the storage counters and bumped metrics
Expand Down Expand Up @@ -711,9 +712,12 @@ func (db *Database) commit(hash common.Hash, batch ethdb.Batch, uncacher *cleane
return err
}
db.lock.Lock()
batch.Replay(uncacher)
err := batch.Replay(uncacher)
batch.Reset()
db.lock.Unlock()
if err != nil {
return err
}
}
return nil
}
Expand Down

0 comments on commit a0bbdd9

Please sign in to comment.