lmdb: ITS#8109 fix mdb_cursor_del0 on empty DB.

Change-Id: Idba0acfd64b597f2bc5cb847ca99fe4560eed875
This commit is contained in:
Howard Chu 2015-04-23 05:49:56 +01:00 committed by Leo Yuriev
parent 1cab8ed564
commit d4bddde7aa
2 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,7 @@ LMDB 0.9.15 Release Engineering
Fix mdb_rebalance collapsing root (ITS#8062) Fix mdb_rebalance collapsing root (ITS#8062)
Fix mdb_load with large values (ITS#8066) Fix mdb_load with large values (ITS#8066)
Fix to retry writes on EINTR (ITS#8106) Fix to retry writes on EINTR (ITS#8106)
Fix mdb_cursor_del on empty DB (ITS#8109)
Added workaround for fdatasync bug in ext3fs Added workaround for fdatasync bug in ext3fs
Build Build
Don't use -fPIC for static lib Don't use -fPIC for static lib

7
mdb.c
View File

@ -8569,6 +8569,13 @@ mdb_cursor_del0(MDB_cursor *mc)
MDB_cursor *m2, *m3; MDB_cursor *m2, *m3;
MDB_dbi dbi = mc->mc_dbi; MDB_dbi dbi = mc->mc_dbi;
/* DB is totally empty now, just bail out.
* Other cursors adjustments were already done
* by mdb_rebalance and aren't needed here.
*/
if (!mc->mc_snum)
return rc;
mp = mc->mc_pg[mc->mc_top]; mp = mc->mc_pg[mc->mc_top];
nkeys = NUMKEYS(mp); nkeys = NUMKEYS(mp);