What is the recommended way to update partial substrings of existing records in lmdb ? I could not find a way that allows to transfer not the entire record, thus wasting memory bandwidth, but only say overwrite a single byte within say a 1 mbyte record, is it acceptable/safe to modify :
mdb_put(offset, partial_len) mdb_cursor_put(offset, partial_len)
... if (F_ISSET(flags, MDB_RESERVE)) data->mv_data = olddata.mv_data; else if (!(mc->mc_flags & C_SUB)) { if(!offset && !partial_len) memcpy(olddata.mv_data, data->mv_data, data->mv_size); else memcpy((char*)olddata.mv_data+offset, data->mv_data, partial_len);// allow partial update within existing record at offset } else { memcpy(NODEKEY(leaf), key->mv_data, key->mv_size); goto fix_parent; } ...
further to that, is it possible to allow retrieving current record size, data with MDB_RESERVE, and what should be done if anything in case one opts not to write anything into the returned data
} else if ((data->mv_size == olddata.mv_size) || F_ISSET(flags, MDB_RESERVE) )// allow retrieving current record size, data with MDB_RESERVE { /* same size, just replace it. Note that we could * also reuse this node if the new data is smaller, * but instead we opt to shrink the node in that case. */ if (F_ISSET(flags, MDB_RESERVE)) { if (!data->mv_size) *data = olddata;// allow retrieving current size, data with MDB_RESERVE by querying with size 0 else data->mv_data = olddata.mv_data; }
openldap-technical@openldap.org