Konstantin Andreev wrote:
> Hi,
> 
> I am contemplating the mdb search mechanics, and puzzled by "missing parent" 
> check in mdb_idscopes():
> 
>     | /* If we didn't advance, some parent is missing */
>     | if ( id == prev )
>     |     return MDB_NOTFOUND;
> 
> where "id" and "prev" are parent and child ids that come from the same "UP" ( 
> child -> parent ) record of "dn2id" table. Here is a source code 
> approximation for
> easier reading:
> 
>     | MDB_val key = { sizeof(ID), & id }, data;
>     | mdb_cursor_get( "dn2id", key, data, MDB_SET );
>     | // reading last sizeof(ID) bytes of data.mv_data
>     | ID prev = *(ID *)(data.mv_data + data.mv_size - sizeof(ID));
> 
> IIUC, there is no records in "dn2id" where parent and child ids are the same. 
> There is no by construction, except "super-root", where both ids are zeros, 
> but
> zero id doesn't follow this execution path.
> 
> So, how may [id == prev] occur? Could you, please, explain?
> 
> The check came from 5a08b661 and 437f21b commits (ITS#7705,#7800 fix ...), I 
> have read both, but they haven't helped either.

If the checks in
http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=servers/slapd/back-mdb/dn2id.c;h=93fd3e387e968a1928eaa0f82211bcbc3687e777;hb=HEAD#l782
 don't
find a result, then id doesn't get advanced any further.
This can happen in a pagedResults search when the underlying set of entries 
changes between page requests.
> 
> Regard, Konstantin.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Reply via email to