Skip to content

Commit

Permalink
Merge pull request #34 from osmosis-labs/roman/concurrent-map-fix
Browse files Browse the repository at this point in the history
fix concurrent map panic when querying and committing concurrently
  • Loading branch information
ValarDragon authored Mar 9, 2022
2 parents 2e0b26a + d8ed9f8 commit d136ed6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions mutable_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,6 @@ func (tree *MutableTree) getUnsavedFastNodeRemovals() map[string]interface{} {
func (tree *MutableTree) addUnsavedAddition(key []byte, node *FastNode) {
delete(tree.unsavedFastNodeRemovals, string(key))
tree.unsavedFastNodeAdditions[string(key)] = node
tree.ndb.cacheFastNode(node)
}

func (tree *MutableTree) saveFastNodeAdditions() error {
Expand All @@ -813,7 +812,6 @@ func (tree *MutableTree) saveFastNodeAdditions() error {
func (tree *MutableTree) addUnsavedRemoval(key []byte) {
delete(tree.unsavedFastNodeAdditions, string(key))
tree.unsavedFastNodeRemovals[string(key)] = true
tree.ndb.uncacheFastNode(key)
}

func (tree *MutableTree) saveFastNodeRemovals() error {
Expand Down
2 changes: 2 additions & 0 deletions nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ func (ndb *nodeDB) DeleteVersionsRange(fromVersion, toVersion int64) error {
}

func (ndb *nodeDB) DeleteFastNode(key []byte) error {
ndb.mtx.Lock()
defer ndb.mtx.Unlock()
if err := ndb.batch.Delete(ndb.fastNodeKey(key)); err != nil {
return err
}
Expand Down

0 comments on commit d136ed6

Please sign in to comment.