From 1db119c657d42c42467ec3a51b630e560ac5b145 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Mon, 14 Jul 2025 08:44:05 +0300 Subject: [PATCH] Use GetCurrentReplayRecPtr instead of GetXLogReplayRecPtr in the check for returned page LSN --- pgxn/neon/communicator.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pgxn/neon/communicator.c b/pgxn/neon/communicator.c index f1b5b4530b..6f8b295862 100644 --- a/pgxn/neon/communicator.c +++ b/pgxn/neon/communicator.c @@ -2230,14 +2230,18 @@ Retry: if (resp->lsn != UINT64_MAX) /* replica */ { XLogRecPtr page_lsn = PageGetLSN((Page)getpage_resp->page); - XLogRecPtr replay_lsn = GetXLogReplayRecPtr(NULL); +#if PG_VERSION_NUM >= 150000 + XLogRecPtr replay_lsn = GetCurrentReplayRecPtr(NULL); +#else + XLogRecPtr replay_lsn = Max(GetXLogReplayRecPtr(NULL), resp->lsn); +#endif if (replay_lsn != 0 && page_lsn > replay_lsn) { /* Alternative to throw error is to repeat the query with request_lsn=replay_lsn */ ereport(ERROR, (errcode(ERRCODE_IO_ERROR), - errmsg("There is no more version of page %u of relation %u/%u/%u.%u at LSN %X/%X at page server, latest version is at LSN %X/%X", - blockno, RelFileInfoFmt(rinfo), forkNum, LSN_FORMAT_ARGS(replay_lsn), LSN_FORMAT_ARGS(page_lsn)))); + errmsg("There is no more version of page %u of relation %u/%u/%u.%u at LSN %X/%X at page server, request LSN %X/%X, latest version is at LSN %X/%X", + blockno, RelFileInfoFmt(rinfo), forkNum, LSN_FORMAT_ARGS(replay_lsn), LSN_FORMAT_ARGS(resp->lsn), LSN_FORMAT_ARGS(page_lsn)))); } } memcpy(buffer, getpage_resp->page, BLCKSZ);