From 9d75a82ae10fdcee80b8b8e82c6ef9b6ab83dc47 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 22 Dec 2015 06:13:25 +0000 Subject: [PATCH] MDB_VL32 - fix prev commit Only tweak length for read-only envs --- libraries/liblmdb/mdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 516e69a7ec..4ff49500a5 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -5803,8 +5803,8 @@ retry: id3.mref = 1; if (id3.mid) goto found; - /* don't map past last written page */ - if (pgno + MDB_RPAGE_CHUNK-1 > txn->mt_last_pgno) + /* don't map past last written page in read-only envs */ + if ((env->me_flags & MDB_RDONLY) && pgno + MDB_RPAGE_CHUNK-1 > txn->mt_last_pgno) id3.mcnt = txn->mt_last_pgno + 1 - pgno; else id3.mcnt = MDB_RPAGE_CHUNK; -- 2.39.5