Some minor refactoring addressing review comments

This commit is contained in:
Konstantin Knizhnik
2025-07-25 20:46:59 +03:00
parent 252876515c
commit 06417f2ff9
3 changed files with 8 additions and 6 deletions

View File

@@ -1922,8 +1922,11 @@ nm_to_string(NeonMessage *msg)
static void
reset_min_request_lsn(int code, Datum arg)
{
if (MyProc != NULL)
MIN_BACKEND_REQUEST_LSN = InvalidXLogRecPtr;
#if PG_MAJORVERSION_NUM < 15
if (!MyProc)
return;
#endif
MIN_BACKEND_REQUEST_LSN = InvalidXLogRecPtr;
}
/*

View File

@@ -13,7 +13,6 @@
#include "funcapi.h"
#include "miscadmin.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#include "storage/shmem.h"
#include "utils/builtins.h"

View File

@@ -590,15 +590,15 @@ neon_get_request_lsns(NRelFileInfo rinfo, ForkNumber forknum, BlockNumber blkno,
/* Request the page at the end of the last fully replayed LSN. */
XLogRecPtr replay_lsn = GetXLogReplayRecPtr(NULL);
if (MIN_BACKEND_PREFETCH_LSN == InvalidXLogRecPtr)
if (MIN_BACKEND_REQUEST_LSN == InvalidXLogRecPtr)
{
/* mark the backend's replay_lsn as "we have a request ongoing", blocking the expiration of any current LSN */
MIN_BACKEND_PREFETCH_LSN = replay_lsn;
MIN_BACKEND_REQUEST_LSN = replay_lsn;
/* make sure memory operations are in correct order, even in concurrent systems */
pg_memory_barrier();
/* get the current LSN to register */
replay_lsn = GetXLogReplayRecPtr(NULL);
MIN_BACKEND_PREFETCH_LSN = replay_lsn;
MIN_BACKEND_REQUEST_LSN = replay_lsn;
}
last_replay_lsn = replay_lsn;
for (int i = 0; i < nblocks; i++)