From 06417f2ff9e82bbe0fc11a083454514303a15a54 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Fri, 25 Jul 2025 20:46:59 +0300 Subject: [PATCH] Some minor refactoring addressing review comments --- pgxn/neon/communicator.c | 7 +++++-- pgxn/neon/neon_perf_counters.c | 1 - pgxn/neon/pagestore_smgr.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pgxn/neon/communicator.c b/pgxn/neon/communicator.c index 56259046b2..c8c7b5bf07 100644 --- a/pgxn/neon/communicator.c +++ b/pgxn/neon/communicator.c @@ -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; } /* diff --git a/pgxn/neon/neon_perf_counters.c b/pgxn/neon/neon_perf_counters.c index dae380b603..e8ce83e7a7 100644 --- a/pgxn/neon/neon_perf_counters.c +++ b/pgxn/neon/neon_perf_counters.c @@ -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" diff --git a/pgxn/neon/pagestore_smgr.c b/pgxn/neon/pagestore_smgr.c index 7fd7656a97..c6f0dfcd85 100644 --- a/pgxn/neon/pagestore_smgr.c +++ b/pgxn/neon/pagestore_smgr.c @@ -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++)