diff --git a/CHANGELOG.md b/CHANGELOG.md index 983ec80dd..fe4f1b974 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Special thanks to external contributors on this release: ### Bug Fix +- [nodedb] [\#219](https://github.com/tendermint/iavl/pull/219) Fix a concurrent database access issue when deleting orphans + ## 0.13.0 (January 16, 2020) Special thanks to external contributors on this release: @@ -17,7 +19,7 @@ Special thanks to external contributors on this release: ### BREAKING CHANGES -- [pruning] [/#158](https://github.com/tendermint/iavl/pull/158) NodeDB constructor must provide `keepRecent` and `keepEvery` fields to define PruningStrategy. All Save functionality must specify whether they should flushToDisk as well using `flushToDisk` boolean argument. All Delete functionality must specify whether object should be deleted from memory only using the `memOnly` boolean argument. +- [pruning] [\#158](https://github.com/tendermint/iavl/pull/158) NodeDB constructor must provide `keepRecent` and `keepEvery` fields to define PruningStrategy. All Save functionality must specify whether they should flushToDisk as well using `flushToDisk` boolean argument. All Delete functionality must specify whether object should be deleted from memory only using the `memOnly` boolean argument. - [dep] [\#194](https://github.com/tendermint/iavl/pull/194) Update tm-db to 0.4.0 this includes interface breaking to return errors. ### IMPROVEMENTS diff --git a/nodedb.go b/nodedb.go index 1ed62cc0c..d9c8802e9 100644 --- a/nodedb.go +++ b/nodedb.go @@ -284,17 +284,13 @@ func (ndb *nodeDB) deleteOrphans(version int64, memOnly bool) error { if ndb.opts.KeepRecent != 0 { ndb.deleteOrphansMem(version) } - var err error if ndb.isSnapshotVersion(version) && !memOnly { predecessor := getPreviousVersionFromDB(version, ndb.snapshotDB) traverseOrphansVersionFromDB(ndb.snapshotDB, version, func(key, hash []byte) { - err = ndb.snapshotDB.Delete(key) + ndb.snapshotBatch.Delete(key) ndb.deleteOrphansHelper(ndb.snapshotDB, ndb.snapshotBatch, true, predecessor, key, hash) }) } - if err != nil { - return errors.Wrap(err, "snapshotDB err in delete") - } return nil }