Issue 7861 - Wrong entry count with MDB_DUPSORT databases
Summary: Wrong entry count with MDB_DUPSORT databases
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-05-27 10:14 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-05-27 10:14:03 UTC
Full_Name: Hallvard B Furuseth
Version: mdb.master, 4b9aed26a5b1c0027b10d211c6e7270dbb1ade1c
OS: Linux x86_64
URL: 
Submission from: (NULL) (2001:700:100:556::233)
Submitted by: hallvard


mdb_cursor_put() does not always know if it'll be inserting a
new item or not, e.g. when inserting in a sub-database.  This
was always wrong, but recent commits changed how it was wrong.

Fix: Split 'insert' in 'insert_key' + 'insert_data'.  Compute
insert_data from mx_db.md_entries before and after the insert.
In my UiO repo, branch mdb/todo-3:
  02dd3865d5 [Rewritten] ITS#xxxx Fix MDB_db.md_entries.
  c6c78f71d3 [New] Tweak varname 'insert'.
  (Cosmetic patch which does not apply cleanly, I guess I should
  make an mdb/todo-4 branch where it is applied earlier.)
Affects ITS#7834.

mdb_cursor_del(, MDB_NODUPDATA) only subtracts 1 from md_entries
when deleting a sub-page, instead of no of DUP entries.
Fix:
  fa8e827026 [New,Squash] Fix md_entries in  mdb_cursor_del:MDB_NODUPDATA.
Comment 1 Hallvard Furuseth 2014-05-29 07:20:17 UTC
More:

mdb_cursor_put() now tracks data items instead of keys in
md_entries, broken by 13d6d59c512065db3741c20c65b4d9928b986968.

mdb_cursor_del(, MDB_NODUPDATA) is off-by-one for sub-DBs: It
subtracts subDB.md_entries, then mdb_cursor_del0() subtracts 1.

Fixing.

Comment 2 Hallvard Furuseth 2014-05-29 07:51:27 UTC
> mdb_cursor_put() now tracks data items instead of keys in
> md_entries, broken by 13d6d59c512065db3741c20c65b4d9928b986968.

oops, that was backwards.  Changed to tracking keys from data items.


Comment 3 Hallvard Furuseth 2014-05-30 03:17:59 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 4 OpenLDAP project 2014-08-01 21:04:51 UTC
fixed in mdb.master
Comment 5 Quanah Gibson-Mount 2014-12-11 01:02:22 UTC
changed state Test to Closed