From f0f09edbb38c1a5eaf2a57c2c16ba78ecaeb5a19 Mon Sep 17 00:00:00 2001 From: Artyom Ivanov Date: Mon, 23 Mar 2026 14:58:24 +0300 Subject: [PATCH] fix(pag): Incorrect calculation of last used page when database contains only one PIP --- src/jrd/pag.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jrd/pag.cpp b/src/jrd/pag.cpp index 8b4e1d33697..dfdd9a9d3e2 100644 --- a/src/jrd/pag.cpp +++ b/src/jrd/pag.cpp @@ -1855,7 +1855,9 @@ ULONG PageSpace::lastUsedPage() CCH_RELEASE(tdbb, &window); pipMaxKnown = pipLast; - return last_bit + (pipLast == pipFirst ? 0 : pipLast); + if (pipLast == pipFirst) + return last_bit > 0 ? last_bit : 0; + return pipLast + last_bit + 1; } ULONG PageSpace::lastUsedPage(const Database* dbb)