Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ff2942a

Browse files
author
Anton Voloshin
committed
adapt pg_pathman for upcoming PostgreSQL 15
Only call RequestAddinShmemSpace from within our implementation of shmem_request_hook (as required after commit 4f2400cb3 in PostgreSQL 15).
1 parent afddc65 commit ff2942a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/pg_pathman.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ pathman_xact_cb(XactEvent event, void *arg)
314314
* -------------------
315315
*/
316316

317+
#if PG_VERSION_NUM >= 150000
318+
static shmem_request_hook_type prev_shmem_request_hook = NULL;
319+
static void pg_pathman_shmem_request(void);
320+
#endif
321+
317322
/* Set initial values for all Postmaster's forks */
318323
void
319324
_PG_init(void)
@@ -326,7 +331,12 @@ _PG_init(void)
326331
}
327332

328333
/* Request additional shared resources */
334+
#if PG_VERSION_NUM >= 150000
335+
prev_shmem_request_hook = shmem_request_hook;
336+
shmem_request_hook = pg_pathman_shmem_request;
337+
#else
329338
RequestAddinShmemSpace(estimate_pathman_shmem_size());
339+
#endif
330340

331341
/* Assign pg_pathman's initial state */
332342
pathman_init_state.pg_pathman_enable = DEFAULT_PATHMAN_ENABLE;
@@ -363,6 +373,17 @@ _PG_init(void)
363373
#endif
364374
}
365375

376+
#if PG_VERSION_NUM >= 150000
377+
static void
378+
pg_pathman_shmem_request(void)
379+
{
380+
if (prev_shmem_request_hook)
381+
prev_shmem_request_hook();
382+
383+
RequestAddinShmemSpace(estimate_pathman_shmem_size());
384+
}
385+
#endif
386+
366387
/* Get cached PATHMAN_CONFIG relation Oid */
367388
Oid
368389
get_pathman_config_relid(bool invalid_is_ok)

0 commit comments

Comments
 (0)