PostgreSQL Source Code  git master
auxprocess.c File Reference
#include "postgres.h"
#include <unistd.h>
#include <signal.h>
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/auxprocess.h"
#include "postmaster/bgwriter.h"
#include "postmaster/startup.h"
#include "postmaster/walsummarizer.h"
#include "postmaster/walwriter.h"
#include "replication/walreceiver.h"
#include "storage/condition_variable.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#include "storage/procsignal.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
Include dependency graph for auxprocess.c:

Go to the source code of this file.

Functions

static void ShutdownAuxiliaryProcess (int code, Datum arg)
 
void AuxiliaryProcessMainCommon (void)
 

Function Documentation

◆ AuxiliaryProcessMainCommon()

void AuxiliaryProcessMainCommon ( void  )

Definition at line 44 of file auxprocess.c.

45 {
47 
48  /* Release postmaster's working memory context */
50  {
52  PostmasterContext = NULL;
53  }
54 
55  init_ps_display(NULL);
56 
58  IgnoreSystemIndexes = true;
59 
60  /*
61  * As an auxiliary process, we aren't going to do the full InitPostgres
62  * pushups, but there are a couple of things that need to get lit up even
63  * in an auxiliary process.
64  */
65 
66  /*
67  * Create a PGPROC so we can use LWLocks and access shared memory.
68  */
70 
71  BaseInit();
72 
74 
75  /*
76  * Auxiliary processes don't run transactions, but they may need a
77  * resource owner anyway to manage buffer pins acquired outside
78  * transactions (and, perhaps, other things in future).
79  */
81 
82 
83  /* Initialize backend status information */
84  pgstat_beinit();
86 
87  /* register a before-shutdown callback for LWLock cleanup */
89 
91 }
static void ShutdownAuxiliaryProcess(int code, Datum arg)
Definition: auxprocess.c:101
void pgstat_beinit(void)
void pgstat_bestart(void)
#define Assert(condition)
Definition: c.h:858
bool IsUnderPostmaster
Definition: globals.c:117
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition: ipc.c:337
MemoryContext PostmasterContext
Definition: mcxt.c:151
void MemoryContextDelete(MemoryContext context)
Definition: mcxt.c:454
@ NormalProcessing
Definition: miscadmin.h:449
@ BootstrapProcessing
Definition: miscadmin.h:447
#define SetProcessingMode(mode)
Definition: miscadmin.h:460
bool IgnoreSystemIndexes
Definition: miscinit.c:80
void BaseInit(void)
Definition: postinit.c:645
void ProcSignalInit(void)
Definition: procsignal.c:158
void init_ps_display(const char *fixed_part)
Definition: ps_status.c:267
void CreateAuxProcessResourceOwner(void)
Definition: resowner.c:982
void InitAuxiliaryProcess(void)
Definition: proc.c:523

References Assert, BaseInit(), before_shmem_exit(), BootstrapProcessing, CreateAuxProcessResourceOwner(), IgnoreSystemIndexes, init_ps_display(), InitAuxiliaryProcess(), IsUnderPostmaster, MemoryContextDelete(), NormalProcessing, pgstat_beinit(), pgstat_bestart(), PostmasterContext, ProcSignalInit(), SetProcessingMode, and ShutdownAuxiliaryProcess().

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

◆ ShutdownAuxiliaryProcess()

static void ShutdownAuxiliaryProcess ( int  code,
Datum  arg 
)
static

Definition at line 101 of file auxprocess.c.

102 {
106 }
bool ConditionVariableCancelSleep(void)
void LWLockReleaseAll(void)
Definition: lwlock.c:1878
static void pgstat_report_wait_end(void)
Definition: wait_event.h:98

References ConditionVariableCancelSleep(), LWLockReleaseAll(), and pgstat_report_wait_end().

Referenced by AuxiliaryProcessMainCommon().