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

Big leaf nodes in LMDBv2



LMDBv1 supports 1-node leaf pages so it can split a 2-node leaf to
make room for a 3rd node. (ITS#8237).

LMDBv2 could extend this, to use fewer pages: Allow oversized leaf
nodes.  mdb_cursor_put() won't create ovpages directly, but call
page_split() which instead of splitting may kick an oversized node
and/or the new node out to an ovpage.  Usually only the biggest of
the two.  To assist page_split(), give such leaf pages a flag
P_HAS_BIGNODE and set mp_pad = size of the biggest oversized node.
That gets a bit simpler if we allow only 1 oversized node per leaf.

The inverse fix is "a page has room for 3 nodes".  This reduces
me_nodemax from 2038 1358, max supported MDB_MAXKEYSIZE from 1982
to 1302, and uses more ovpages.  Add mdb_env_set_pagesize() so
LMDBv2 with bigger pages can reload an LMDBv1 DB with big keys.

Hallvard