From 116eb3601eb56be1d6fdc608e9a7161351b49263 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Mon, 9 Apr 2012 04:45:32 -0700
Subject: [PATCH] ITS#7229 additional tweaks

Should probably compare nsize to pg_size/4 instead...
---
 libraries/libmdb/mdb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c
index 954690e149..724fdf1b2c 100644
--- a/libraries/libmdb/mdb.c
+++ b/libraries/libmdb/mdb.c
@@ -5711,7 +5711,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno
 	}
 
 	nkeys = NUMKEYS(mp);
-	split_indx = nkeys / 2 + 1;
+	split_indx = (nkeys + 1) / 2;
 
 	if (IS_LEAF2(rp)) {
 		char *split, *ins;
@@ -5765,7 +5765,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno
 	 * When the size of the data items is much smaller than
 	 * one-half of a page, this check is irrelevant.
 	 */
-	if (IS_LEAF(mp) && nkeys < 4) {
+	if (IS_LEAF(mp) && nkeys < 16) {
 		unsigned int psize, nsize;
 		/* Maximum free space in an empty page */
 		pmax = mc->mc_txn->mt_env->me_psize - PAGEHDRSZ;
-- 
GitLab