On 25/08/2023 07:29, Imseih (AWS), Sami wrote:
diff --git a/src/backend/storage/lmgr/predicate.c
b/src/backend/storage/lmgr/predicate.c
index 1af41213b4..7e7be3b885 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -992,6 +992,13 @@ SerialSetActiveSerXmin(TransactionId xid)
serialControl->tailXid = xid;
+ /*
+ * If the SLRU is being used, set the latest page number to
+ * the current tail xid.
+ */
+ if (serialControl->headPage > 0)
+ SerialSlruCtl->shared->latest_page_number =
SerialPage(serialControl->tailXid);
+
LWLockRelease(SerialSLRULock);
}
I don't really understand what exactly the problem is, or how this fixes
it. But this doesn't feel right:
Firstly, isn't headPage == 0 also a valid value? We initialize headPage
to -1 when it's not in use.
Secondly, shouldn't we set it to the page corresponding to headXid
rather than tailXid.
Thirdly, I don't think this code should have any business setting
latest_page_number directly. latest_page_number is set in
SimpleLruZeroPage(). Are we missing a call to SimpleLruZeroPage() somewhere?
--
Heikki Linnakangas
Neon (https://neon.tech)