On 27/05/15 09:00, sergej.jurecko(a)gmail.com wrote:
Using a dupsort and writing a large value (which is still bellow
will result in MDB_PAGE_FULL.
Too big MDB_MAXKEYSIZE. Its doc says:
"Keys and MDB_DUPSORT data items must fit on a node in a regular page."
But the doc should clarify that MDB_MAXKEYSIZE can be set big enough
to break lmdb.
Or mdb_env_open() can fail if the computed me_maxkey would be smaller.
Or compute a safe MIN_PAGESIZE from MDB_MAXKEYSIZE and use that,
and then fail if the page size would be unsupported. (MIN_PAGESIZE
can be computed at compile time, with some ugly macros.)
lmdb sets the max safe maxkeysize if you define MDB_MAXKEYSIZE=0.
Some time ago, that was 1/3 of the size you could reasonably use
(to allow 1 key + sub-page with 2 dupsort values), so it could make
sense to define MDB_MAXKEYSIZE above the safe max. Today lmdb
uses a sub-DB at once if a sub-page would be too small, though.
So I don't see much need to support maxkeysize > safe max.