[Date Prev][Date Next]
(ITS#7834) MDB_MULTIPLE can insert multiple keys
Full_Name: Hallvard B Furuseth
Version: LMDB 0.9.11
OS: Linux x86_64
Submission from: (NULL) (22.214.171.124)
Submitted by: hallvard
mdb_cursor_put(,new key, multiple data items, MDB_MULTIPLE)
inserts several identical keys as well as multiple data items.
Broken since 0.9.10 by 4c8f57615c5ca7b014c038e59c1045182e74f5ad.
OpenLDAP is not affected, since it no longer uses MDB_MULTIPLE.
Root cause: mdb_cursor_put() does not reset the 'insert' flag
when looping through MDB_MULTIPLE. Recently it uses that flag
to decode whether to delete the old key before re-inserting it.
Also MDB_MULTIPLE breaks MDB_db.md_entries so mdb_stat() reports
the wrong number of entries. This was always so. The 'insert'
flag also affects cursor tracking. I have not checked how.
Fix: Reset 'insert' before looping, and move setting C_INITIALIZED
at 'done:' before that again. This should make MDB_MULTIPLE behave
like a sequence of put()s, except it does not repeat spill/touch.