PostgreSQL Source Code git master
Loading...
Searching...
No Matches
auxprocess.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void AuxiliaryProcessMainCommon (void)
 

Function Documentation

◆ AuxiliaryProcessMainCommon()

void AuxiliaryProcessMainCommon ( void  )
extern

Definition at line 41 of file auxprocess.c.

42{
44
45 /* Release postmaster's working memory context */
47 {
50 }
51
53
55
57
58 /*
59 * As an auxiliary process, we aren't going to do the full InitPostgres
60 * pushups, but there are a couple of things that need to get lit up even
61 * in an auxiliary process.
62 */
63
64 /*
65 * Create a PGPROC so we can use LWLocks and access shared memory.
66 */
68
69 BaseInit();
70
71 /*
72 * Prevent consuming interrupts between setting ProcSignalInit and setting
73 * the initial local data checksum value. If a barrier is emitted, and
74 * absorbed, before local cached state is initialized the state transition
75 * can be invalid.
76 */
78
80
81 /*
82 * Initialize a local cache of the data_checksum_version, to be updated by
83 * the procsignal-based barriers.
84 *
85 * This intentionally happens after initializing the procsignal, otherwise
86 * we might miss a state change. This means we can get a barrier for the
87 * state we've just initialized - but it can happen only once.
88 *
89 * The postmaster (which is what gets forked into the new child process)
90 * does not handle barriers, therefore it may not have the current value
91 * of LocalDataChecksumVersion value (it'll have the value read from the
92 * control file, which may be arbitrarily old).
93 *
94 * NB: Even if the postmaster handled barriers, the value might still be
95 * stale, as it might have changed after this process forked.
96 */
98
100
101 /*
102 * Auxiliary processes don't run transactions, but they may need a
103 * resource owner anyway to manage buffer pins acquired outside
104 * transactions (and, perhaps, other things in future).
105 */
107
108
109 /* Initialize backend status information */
113
114 /* register a before-shutdown callback for LWLock cleanup */
116
118}
static void ShutdownAuxiliaryProcess(int code, Datum arg)
Definition auxprocess.c:128
void pgstat_bestart_initial(void)
void pgstat_beinit(void)
void pgstat_bestart_final(void)
#define Assert(condition)
Definition c.h:943
bool IsUnderPostmaster
Definition globals.c:122
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition ipc.c:344
MemoryContext PostmasterContext
Definition mcxt.c:168
void MemoryContextDelete(MemoryContext context)
Definition mcxt.c:472
#define RESUME_INTERRUPTS()
Definition miscadmin.h:138
@ NormalProcessing
Definition miscadmin.h:490
@ InitProcessing
Definition miscadmin.h:489
#define GetProcessingMode()
Definition miscadmin.h:499
#define HOLD_INTERRUPTS()
Definition miscadmin.h:136
#define SetProcessingMode(mode)
Definition miscadmin.h:501
bool IgnoreSystemIndexes
Definition miscinit.c:82
void BaseInit(void)
Definition postinit.c:616
static int fb(int x)
void ProcSignalInit(const uint8 *cancel_key, int cancel_key_len)
Definition procsignal.c:170
void init_ps_display(const char *fixed_part)
Definition ps_status.c:286
void CreateAuxProcessResourceOwner(void)
Definition resowner.c:996
void InitAuxiliaryProcess(void)
Definition proc.c:618
void InitLocalDataChecksumState(void)
Definition xlog.c:4966

References Assert, BaseInit(), before_shmem_exit(), CreateAuxProcessResourceOwner(), fb(), GetProcessingMode, HOLD_INTERRUPTS, IgnoreSystemIndexes, init_ps_display(), InitAuxiliaryProcess(), InitLocalDataChecksumState(), InitProcessing, IsUnderPostmaster, MemoryContextDelete(), NormalProcessing, pgstat_beinit(), pgstat_bestart_final(), pgstat_bestart_initial(), PostmasterContext, ProcSignalInit(), RESUME_INTERRUPTS, SetProcessingMode, and ShutdownAuxiliaryProcess().

Referenced by BackgroundWriterMain(), CheckpointerMain(), IoWorkerMain(), PgArchiverMain(), StartupProcessMain(), WalReceiverMain(), WalSummarizerMain(), and WalWriterMain().