Skip to content

Commit

Permalink
clone is not needed here
Browse files Browse the repository at this point in the history
redundant since dbWriter uses a clone
  • Loading branch information
roysc committed Aug 23, 2021
1 parent e193214 commit e17792b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions db/memdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func (db *MemDB) ReadWriter() dbm.DBReadWriter {
db.mtx.RLock()
defer db.mtx.RUnlock()
atomic.AddInt32(&db.openWriters, 1)
// Clone creates a copy-on-write extension of the current tree
return &dbWriter{db.newTxn(db.btree.Clone())}
}

Expand All @@ -124,8 +125,6 @@ func (db *MemDB) save(target uint64) (uint64, error) {
return 0, err
}
db.saved[target] = db.btree
// BTree's Clone() makes a CoW extension of the current tree
db.btree = db.btree.Clone()
db.vmgr = newVmgr
return target, nil
}
Expand Down

0 comments on commit e17792b

Please sign in to comment.