[Date Prev][Date Next] [Chronological] [Thread] [Top]

MDB_INTEGERDUP in back-mdb's indexer for attr-tables.



Hi, Howard.

I would like to refine my question.

Currently I develop a mdb_chk tool for deep check LMDB-files, like a fsck tool.
It is needed for us, but let this stay aside for now.

On some step I plan to check the size of each key in each DBI with
MDB_INTEGERKEY and/or MDB_INTEGERDUP flags.

Initially I assumed - if one of these flags is set, the the length of
all keys must be sizeof(int) or sizeof(long). As will be used the
corresponding comparison functions (mdb_cmp_int, mdb_cmp_long) , which
can handle only keys of such sizes.

But this approach has failed. A dbi-tables created for attr by
mdb_attr_dbs_open() have MDB_DUPSORT|MDB_DUPFIXED|MDB_INTEGERDUP flags
and may contain records with a 5-byte keys. For instance as the
'entryCSN'.

Later you have written that MDB_INTEGERDUP is required.

Now I do not understand how it all works:
 - MDB_INTEGERDUP is set for attr tables.
 - indexer could create a 5-byte keys.
 - mdb-backend set custom comparison function only for MDB_DN2ID table.
 - under debugger I see that md_dcmp is pointed to the default.
 - assert for key-size in default comparators was not failed while "make test".
 - all test are passed without MDB_INTEGERDUP.
 - but you told MDB_INTEGERDUP is necessary

So,
- how and when MDB_INTEGERDUP will have an impact?
- in which cases keys in the table definitely should be sizeof(int) or
sizeof(long)?

Thank in advance,
Leonid.