Mark Zealey wrote:
Hi Howard,
I've now switched the database to use MDB_DUPSORT and found what seems
to be another issue to do with invalid data being returned after
mdb_cursor_del. The following code shows the behaviour against a
database that I can provide you with if you need:
It would help if you actually checked the return code from mdb_cursor_get.
rc = mdb_cursor_open(txn, dbi, &cursor);
char seek[] = "ku.oc.repmulp\t";
key.mv_size = sizeof(seek);
key.mv_data = &seek;
mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE);
for( i = 0; i < 15; i++ ) {
mdb_cursor_del( cursor, MDB_NODUPDATA );
data.mv_size = 0;
key.mv_size = 0;
mdb_cursor_get( cursor, &key, &data,
//MDB_NEXT
MDB_GET_CURRENT
);
if( key.mv_size == 0 )
printf("WARNING 0 SIZE KEY\n");
else
printf("KEY OK: %d: %.*s\n", key.mv_size, key.mv_size,
key.mv_data);
if( data.mv_size == 0 )
printf("WARNING 0 SIZE DATA\n");
else
printf("DATA OK: %d: %.*s\n", data.mv_size,
data.mv_size, data.mv_data);
}
mdb_txn_abort(txn);
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/