From: Howard Chu Date: Thu, 27 Sep 2012 12:01:53 +0000 (-0700) Subject: ITS#7385, check further for bad splits X-Git-Tag: OPENLDAP_REL_ENG_2_4_33~6^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0c4c6fe72a57f812e4486cd017298f730df19c23;p=openldap ITS#7385, check further for bad splits More for 48ef27b6f5c804eca6a9d27f8dd2b4ded376f8af Our definition of "large" data item needs to be smaller to handle more cases where a bad split is possible --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 807294c28d..d15fa7c8a7 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -6117,15 +6117,19 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno * This check is only needed when the data items are * relatively large, such that being off by one will * make the difference between success or failure. - * When the size of the data items is much smaller than - * one-half of a page, this check is irrelevant. + * + * It's also relevant if a page happens to be laid out + * such that one half of its nodes are all "small" and + * the other half of its nodes are "large." If the new + * item is also "large" and falls on the half with + * "large" nodes, it also may not fit. */ if (IS_LEAF(mp)) { unsigned int psize, nsize; /* Maximum free space in an empty page */ pmax = mc->mc_txn->mt_env->me_psize - PAGEHDRSZ; nsize = mdb_leaf_size(mc->mc_txn->mt_env, newkey, newdata); - if ((nkeys < 20) || (nsize > pmax/4)) { + if ((nkeys < 20) || (nsize > pmax/16)) { if (newindx <= split_indx) { psize = nsize; newpos = 0;