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

[LMDB] What pointer is returned with combination of MDB_WRITEMAP and MDB_RESERVE?


Docs for MDB_RESERVE say that a returned pointer to the reserved space is valid "before the next update operation or the transaction ends." Docs for MDB_WRITEMAP say that it "writes directly to the mmap instead of using malloc for pages." Does combining the two options return a pointer directly to a place in a mmap so that this pointer could be used after a transaction ends or after the next update?

I have a use case where I want to somewhat abuse LMDB safety for convenience. If I could get a pointer to a place inside a mmap I could work with LMDB value as opaque blob or as a region inside the single big mmap. This could be more convenient than creating and opening hundreds of temporary memory mapped files and keeping open handles to them. For example, Aeron terms could be stored like this: a stream id per an LMDB db and a term id for a key in the db.