Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c89eda

Browse files
committed
Fix compatibility with pg15 new shmem_request_hook.
Hook added upstream in 4f2400cb3f10aa79f99fba680c198237da28dd38.
1 parent1a8aa64 commit7c89eda

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

‎pg_wait_sampling.c‎

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ shm_mq *recv_mq = NULL;
5858
shm_mq_handle*recv_mqh=NULL;
5959
LOCKTAGqueueTag;
6060

61+
#ifPG_VERSION_NUM >=150000
62+
staticshmem_request_hook_typeprev_shmem_request_hook=NULL;
63+
#endif
6164
staticshmem_startup_hook_typeprev_shmem_startup_hook=NULL;
6265
staticPGPROC*search_proc(intbackendPid);
6366
staticPlannedStmt*pgws_planner_hook(Query*parse,
@@ -91,6 +94,10 @@ get_max_procs_count(void)
9194
{
9295
intcount=0;
9396

97+
#ifPG_VERSION_NUM >=150000
98+
Assert(MaxBackends>0);
99+
count+=MaxBackends;
100+
#else
94101
/*
95102
* MaxBackends: bgworkers, autovacuum workers and launcher.
96103
* This has to be in sync with the value computed in
@@ -105,7 +112,8 @@ get_max_procs_count(void)
105112
*/
106113
#ifPG_VERSION_NUM >=120000
107114
count+=max_wal_senders;
108-
#endif
115+
#endif/* pg 12+ */
116+
#endif/* pg 15- */
109117

110118
/* AuxiliaryProcs */
111119
count+=NUM_AUXILIARY_PROCS;
@@ -265,6 +273,23 @@ setup_gucs()
265273
}
266274
}
267275

276+
#ifPG_VERSION_NUM >=150000
277+
/*
278+
* shmem_request hook: request additional shared memory resources.
279+
*
280+
* If you change code here, don't forget to also report the modifications in
281+
* _PG_init() for pg14 and below.
282+
*/
283+
staticvoid
284+
pgws_shmem_request(void)
285+
{
286+
if (prev_shmem_request_hook)
287+
prev_shmem_request_hook();
288+
289+
RequestAddinShmemSpace(pgws_shmem_size());
290+
}
291+
#endif
292+
268293
/*
269294
* Distribute shared memory.
270295
*/
@@ -344,20 +369,27 @@ _PG_init(void)
344369
if (!process_shared_preload_libraries_in_progress)
345370
return;
346371

372+
#ifPG_VERSION_NUM<150000
347373
/*
348374
* Request additional shared resources. (These are no-ops if we're not in
349375
* the postmaster process.) We'll allocate or attach to the shared
350376
* resources in pgws_shmem_startup().
377+
*
378+
* If you change code here, don't forget to also report the modifications
379+
* in pgsp_shmem_request() for pg15 and later.
351380
*/
352381
RequestAddinShmemSpace(pgws_shmem_size());
382+
#endif
353383

354384
register_wait_collector();
355385

356386
/*
357387
* Install hooks.
358388
*/
359-
prev_shmem_startup_hook=shmem_startup_hook;
360-
shmem_startup_hook=pgws_shmem_startup;
389+
#ifPG_VERSION_NUM >=150000
390+
prev_shmem_request_hook=shmem_request_hook;
391+
shmem_request_hook=pgws_shmem_request;
392+
#endif
361393
prev_shmem_startup_hook=shmem_startup_hook;
362394
shmem_startup_hook=pgws_shmem_startup;
363395
planner_hook_next=planner_hook;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp