42
42
#include "replication/slot.h"
43
43
#include "replication/slotsync.h"
44
44
#include "replication/syncrep.h"
45
- #include "replication/walsender.h"
46
45
#include "storage/condition_variable.h"
47
46
#include "storage/ipc.h"
48
47
#include "storage/lmgr.h"
@@ -310,11 +309,11 @@ InitProcess(void)
310
309
elog (ERROR , "you already exist" );
311
310
312
311
/* Decide which list should supply our PGPROC. */
313
- if (IsAnyAutoVacuumProcess ())
312
+ if (AmAutoVacuumLauncherProcess () || AmAutoVacuumWorkerProcess ())
314
313
procgloballist = & ProcGlobal -> autovacFreeProcs ;
315
- else if (IsBackgroundWorker )
314
+ else if (AmBackgroundWorkerProcess () )
316
315
procgloballist = & ProcGlobal -> bgworkerFreeProcs ;
317
- else if (am_walsender )
316
+ else if (AmWalSenderProcess () )
318
317
procgloballist = & ProcGlobal -> walsenderFreeProcs ;
319
318
else
320
319
procgloballist = & ProcGlobal -> freeProcs ;
@@ -344,7 +343,7 @@ InitProcess(void)
344
343
* in the autovacuum case?
345
344
*/
346
345
SpinLockRelease (ProcStructLock );
347
- if (am_walsender )
346
+ if (AmWalSenderProcess () )
348
347
ereport (FATAL ,
349
348
(errcode (ERRCODE_TOO_MANY_CONNECTIONS ),
350
349
errmsg ("number of requested standby connections exceeds max_wal_senders (currently %d)" ,
@@ -370,8 +369,8 @@ InitProcess(void)
370
369
* Slot sync worker also does not participate in it, see comments atop
371
370
* 'struct bkend' in postmaster.c.
372
371
*/
373
- if (IsUnderPostmaster && !IsAutoVacuumLauncherProcess () &&
374
- !IsLogicalSlotSyncWorker ())
372
+ if (IsUnderPostmaster && !AmAutoVacuumLauncherProcess () &&
373
+ !AmLogicalSlotSyncWorkerProcess ())
375
374
MarkPostmasterChildActive ();
376
375
377
376
/*
@@ -391,11 +390,11 @@ InitProcess(void)
391
390
MyProc -> databaseId = InvalidOid ;
392
391
MyProc -> roleId = InvalidOid ;
393
392
MyProc -> tempNamespaceId = InvalidOid ;
394
- MyProc -> isBackgroundWorker = IsBackgroundWorker ;
393
+ MyProc -> isBackgroundWorker = AmBackgroundWorkerProcess () ;
395
394
MyProc -> delayChkptFlags = 0 ;
396
395
MyProc -> statusFlags = 0 ;
397
396
/* NB -- autovac launcher intentionally does not set IS_AUTOVACUUM */
398
- if (IsAutoVacuumWorkerProcess ())
397
+ if (AmAutoVacuumWorkerProcess ())
399
398
MyProc -> statusFlags |= PROC_IS_AUTOVACUUM ;
400
399
MyProc -> lwWaiting = LW_WS_NOT_WAITING ;
401
400
MyProc -> lwWaitMode = 0 ;
@@ -587,7 +586,7 @@ InitAuxiliaryProcess(void)
587
586
MyProc -> databaseId = InvalidOid ;
588
587
MyProc -> roleId = InvalidOid ;
589
588
MyProc -> tempNamespaceId = InvalidOid ;
590
- MyProc -> isBackgroundWorker = IsBackgroundWorker ;
589
+ MyProc -> isBackgroundWorker = AmBackgroundWorkerProcess () ;
591
590
MyProc -> delayChkptFlags = 0 ;
592
591
MyProc -> statusFlags = 0 ;
593
592
MyProc -> lwWaiting = LW_WS_NOT_WAITING ;
@@ -951,8 +950,8 @@ ProcKill(int code, Datum arg)
951
950
* Slot sync worker is also not a postmaster child, so skip this shared
952
951
* memory related processing here.
953
952
*/
954
- if (IsUnderPostmaster && !IsAutoVacuumLauncherProcess () &&
955
- !IsLogicalSlotSyncWorker ())
953
+ if (IsUnderPostmaster && !AmAutoVacuumLauncherProcess () &&
954
+ !AmLogicalSlotSyncWorkerProcess ())
956
955
MarkPostmasterChildInactive ();
957
956
958
957
/* wake autovac launcher if needed -- see comments in FreeWorkerInfo */
0 commit comments