On 22/12/13 23:09, h.b.furuseth@usit.uio.no wrote:
I.e. lots more code needs something like if ((leaf->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) m2->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(leaf); before using an xcursor. I tried that everywhere before using xcursors: That helped, but it was not enough. E.g. after mdb_cursor_del() calls mdb_node_shrink(), it tracks cursors in the same sub-page but not nearby sub-pages.
Such fixups do heal this ITS's test program with current mdb.master, though. That is, perl -i -pe ' s/\b(\w+)->mc_xcursor->mx_cursor./mdb_subcursor($1)->/gx; s/&(\w+)->mc_xcursor->mx_cursor/mdb_subcursor($1)/gx;' mdb.c
plus this function:
static MDB_cursor * mdb_subcursor(MDB_cursor *mc) { MDB_xcursor *mx = mc->mc_xcursor; MDB_cursor *subc = NULL; MDB_page *mp = mc->mc_pg[mc->mc_top]; if (mx) { subc = &mx->mx_cursor; if (((mc->mc_flags | subc->mc_flags) & C_INITIALIZED) && mp && !(mp->mp_flags & (P_BRANCH|P_LEAF2|P_SUBP))) { MDB_node *leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); if ((leaf->mn_flags & (F_SUBDATA|F_DUPDATA)) == F_DUPDATA) subc->mc_pg[0] = NODEDATA(leaf); } } return subc; }