Fix delete

pull/666/head
Howard Chu 2014-06-20 12:42:21 -07:00
parent 4c704f078d
commit 59116761f5
1 changed files with 2 additions and 10 deletions

View File

@ -132,13 +132,7 @@ func (db MDB) Get(key []byte) ([]byte, error) {
}
func (db MDB) Del(start, finish []byte) error {
tx, err := db.env.BeginTxn(nil, 0)
if err != nil {
return err
}
defer tx.Commit()
itr := db.iterator(true)
itr := db.iterator(false)
defer itr.Close()
count := 0
@ -148,9 +142,7 @@ func (db MDB) Del(start, finish []byte) error {
break
}
// TODO: We should be using one cursor instead of two
// transactions, but deleting using a cursor, crashes
err = tx.Del(db.db, itr.key, nil)
err := itr.c.Del(0)
if err != nil {
return err
}