Hi all,
I am inserting a non-zero length key into a database where I provide a compare function. But I am seeing that MDB_val->mv_size = 0 in the compare function. Is that possible?
More details (LMDB 0.9.11 Release):
I have a database where I want to delete all elements that have the same prefix.
void eraseElements (KeyPrefix prefix, MDB_txn *txn, MDB_dbi database)
{
MDB_val k;
k.mv_data = &prefix;
k.mv_size = sizeof (KeyPrefix);
MDB_val v;
MDB_cursor *cur;
mdb_cursor_open (txn, database, &cur);
while (! mdb_cursor_get (cur, &k, &v, MDB_SET_RANGE))
{
if (memcmp (&prefix, k.mv_data, sizeof (KeyPrefix)) != 0) break;
mdb_cursor_del (cur, 0);
k.mv_data = &prefix;
k.mv_size = sizeof (KeyPrefix);
}
mdb_cursor_close (cur);
}
Relevant stack trace
DB::compare (a, b) and b->mv_size == 0
mdb_cursor_set(mc, key, data, op=MDB_SET_RANGE, exactp=0x0) at mdb.c:5348
mdb_cursor_get(mc,key,data,op=MDB_SET_RANGE) at mdb.c:5655
eraseElements(..)