Skip to content

Commit 6417ff8

Browse files
committed
Tentative fix for MDB_PAGE_FULL errors
https://bugs.openldap.org/show_bug.cgi?id=9806 notes MDB_PAGE_FULL can occur for widely varying record sizes (which we definitely have). The size chosen for `nkeys` was for 4KB pages, but M1s (and up) have 16KB pages. For now set this based on the page size of the system, at least until there's an actual fix in LMDB itself. Resolves rdar://100363010.
1 parent 2ff1c04 commit 6417ff8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Database/lmdb/mdb.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9790,7 +9790,12 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno
97909790
* the split so the new page is emptier than the old page.
97919791
* This yields better packing during sequential inserts.
97929792
*/
9793-
if (nkeys < 32 || nsize > pmax/16 || newindx >= nkeys) {
9793+
// INDEXSTOREDB START
9794+
// Changed in IndexStoreDB's copy of LMDB only. Should be removed once
9795+
// ITS#9806 is fixed upstream. This changes the `nkeys < 32` check, which
9796+
// seem to work well for larger than 4kb page sizes.
9797+
if (nkeys < env->me_psize/128 || nsize > pmax/16 || newindx >= nkeys) {
9798+
// INDEXSTOREDB END
97949799
/* Find split point */
97959800
psize = 0;
97969801
if (newindx <= split_indx || newindx >= nkeys) {

0 commit comments

Comments
 (0)