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