Issue 7834 - MDB_MULTIPLE can insert multiple keys
Summary: MDB_MULTIPLE can insert multiple keys
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-12 07:31 UTC by Hallvard Furuseth
Modified: 2014-12-11 01:02 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Hallvard Furuseth 2014-04-12 03:13:32 UTC
moved from Incoming to Software Bugs
Comment 1 Hallvard Furuseth 2014-04-12 07:31:09 UTC
Full_Name: Hallvard B Furuseth
Version: LMDB 0.9.11
OS: Linux x86_64
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (81.191.45.35)
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.
Comment 2 Hallvard Furuseth 2014-05-30 03:18:53 UTC
changed notes
changed state Open to Test
Comment 3 OpenLDAP project 2014-08-01 21:04:51 UTC
fixed in mdb.master
Comment 4 Quanah Gibson-Mount 2014-12-11 01:02:14 UTC
changed state Test to Closed