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.

Regard, Konstantin.

Reply via email to