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

Re: (ITS#7589) MDB nodesize issues

Howard Chu writes:
> Fixed now in mdb.master. (...)

The me_nodemax issue remains though.  Should be fixed in my branch

However, another issue:

mdb_node_shrink() can give the node containing the sub-page
uneven size, if MDB_DUPFIXED keys have uneven size:
  mdb_dbi_open(txn, "db", MDB_DUPSORT|MDB_DUPFIXED, &dbi);
  mdb_put(txn, dbi, &(MDB_val){4, "key"}, &(MDB_val){1, "A"}, 0);
  mdb_put(txn, dbi, &(MDB_val){4, "key"}, &(MDB_val){1, "B"}, 0);
  mdb_del(txn, dbi, &(MDB_val){4, "key"}, &(MDB_val){1, "B"});

Fix: Do nothing if the node would be uneven-sized.  Similar to how
mdb_cursor_put() adds room for 4N nodes at a time, with MDB_DUPFIXED.
Dunno if the cursor tracking code in mdb_cursor_del() must still run.

I don't know what to do about databases that already contain such
uneven-sized nodes.  Maybe support reading them (if that needs any
changes), but try to assert when writing.  "Non-LEAF2 nodes are
even-sized" feels like a deeply embedded assumption, but I haven't
really looked.