Skip to content

Commit 02fc8b7

Browse files
authored
Add compatibility macros for MyProcNumber and PGIOAlignedBlock (#12715)
There were a few uses of these already, so collect them to the compatibility header to avoid the repetition and scattered #ifdefs. The definition of MyProcNumber is a little different from what was used before, but the end result is the same. (PGPROC->pgprocno values were just assigned sequentially to all PGPROC array members, see InitProcGlobal(). That's a bit silly, which is why it was removed in v17.)
1 parent 60feb16 commit 02fc8b7

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

pgxn/neon/communicator.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@
7979
#include "access/xlogrecovery.h"
8080
#endif
8181

82-
#if PG_VERSION_NUM < 160000
83-
typedef PGAlignedBlock PGIOAlignedBlock;
84-
#endif
85-
8682
#define NEON_PANIC_CONNECTION_STATE(shard_no, elvl, message, ...) \
8783
neon_shard_log(shard_no, elvl, "Broken connection state: " message, \
8884
##__VA_ARGS__)

pgxn/neon/neon_perf_counters.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,7 @@ extern neon_per_backend_counters *neon_per_backend_counters_shared;
167167
*/
168168
#define NUM_NEON_PERF_COUNTER_SLOTS (MaxBackends + NUM_AUXILIARY_PROCS)
169169

170-
#if PG_VERSION_NUM >= 170000
171170
#define MyNeonCounters (&neon_per_backend_counters_shared[MyProcNumber])
172-
#else
173-
#define MyNeonCounters (&neon_per_backend_counters_shared[MyProc->pgprocno])
174-
#endif
175171

176172
extern void inc_getpage_wait(uint64 latency);
177173
extern void inc_page_cache_read_wait(uint64 latency);

pgxn/neon/neon_pgversioncompat.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#include "fmgr.h"
1010
#include "storage/buf_internals.h"
1111

12+
#if PG_MAJORVERSION_NUM < 16
13+
typedef PGAlignedBlock PGIOAlignedBlock;
14+
#endif
15+
1216
#if PG_MAJORVERSION_NUM < 17
1317
#define NRelFileInfoBackendIsTemp(rinfo) (rinfo.backend != InvalidBackendId)
1418
#else
@@ -158,6 +162,10 @@ InitBufferTag(BufferTag *tag, const RelFileNode *rnode,
158162
#define AmAutoVacuumWorkerProcess() (IsAutoVacuumWorkerProcess())
159163
#endif
160164

165+
#if PG_MAJORVERSION_NUM < 17
166+
#define MyProcNumber (MyProc - &ProcGlobal->allProcs[0])
167+
#endif
168+
161169
#if PG_MAJORVERSION_NUM < 15
162170
extern void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags);
163171
extern TimeLineID GetWALInsertionTimeLine(void);

pgxn/neon/pagestore_smgr.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@
7272
#include "access/xlogrecovery.h"
7373
#endif
7474

75-
#if PG_VERSION_NUM < 160000
76-
typedef PGAlignedBlock PGIOAlignedBlock;
77-
#endif
78-
7975
#include "access/nbtree.h"
8076
#include "storage/bufpage.h"
8177
#include "access/xlog_internal.h"

0 commit comments

Comments
 (0)