PostgreSQL Source Code: src/backend/postmaster/startup.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
21
36
37
38#ifndef USE_POSTMASTER_DEATH_SIGNAL
39
40
41
42
43
44
45
46#define POSTMASTER_POLL_RATE_LIMIT 1024
47#endif
48
49
50
51
52static volatile sig_atomic_t got_SIGHUP = false;
55
56
57
58
59
61
62
63
64
66
67
68
69
70
72
73
74
75
77
78
81
82
84
85
86
87
88
89
90
91
92static void
94{
97}
98
99
100static void
102{
105}
106
107
108static void
110{
113 else
116}
117
118
119
120
121
122
123
124static void
126{
130 bool conninfoChanged;
131 bool slotnameChanged;
132 bool tempSlotChanged = false;
133
135
136 conninfoChanged = strcmp(conninfo, PrimaryConnInfo) != 0;
137 slotnameChanged = strcmp(slotname, PrimarySlotName) != 0;
138
139
140
141
142
143 if (!slotnameChanged && strcmp(PrimarySlotName, "") == 0)
147
148 if (conninfoChanged || slotnameChanged || tempSlotChanged)
150}
151
152
153void
155{
156#ifdef POSTMASTER_POLL_RATE_LIMIT
157 static uint32 postmaster_poll_count = 0;
158#endif
159
160
161
162
164 {
167 }
168
169
170
171
174
175
176
177
178
179
180
184#endif
186 exit(1);
187
188
191
192
195}
196
197
198
199
200
201
202static void
204{
205
208}
209
210
211
212
213
214
215void
217{
218 Assert(startup_data_len == 0);
219
222
223
225
226
227
228
230 pqsignal(SIGINT, SIG_IGN);
232
237
238
239
240
242
243
244
245
249
250
251
252
253 sigprocmask(SIG_SETMASK, &UnBlockSig, NULL);
254
255
256
257
259
260
261
262
263
265}
266
267void
269{
270
271
272
273
274
275
279}
280
281void
283{
285}
286
287bool
289{
291}
292
293void
295{
297}
298
299
300
301
302void
304{
306}
307
308void
310{
311
313 return;
314
317}
318
319
320
321
322void
324{
326
327
329 return;
330
336}
337
338
339
340
341
342void
344{
345
347 return;
348
351}
352
353
354
355
356
357
358bool
360{
361 long seconds;
362 int useconds;
364
365
367 return false;
368
369
372
373 *secs = seconds;
374 *usecs = useconds;
376
377 return true;
378}
void AuxiliaryProcessMainCommon(void)
void disable_startup_progress_timeout(void)
#define POSTMASTER_POLL_RATE_LIMIT
static volatile sig_atomic_t startup_progress_timer_expired
static volatile sig_atomic_t in_restore_command
static void StartupProcExit(int code, Datum arg)
bool IsPromoteSignaled(void)
void PreRestoreCommand(void)
void startup_progress_timeout_handler(void)
static volatile sig_atomic_t shutdown_requested
static void StartupProcShutdownHandler(SIGNAL_ARGS)
void begin_startup_progress_phase(void)
void ProcessStartupProcInterrupts(void)
void ResetPromoteSignaled(void)
static void StartupProcSigHupHandler(SIGNAL_ARGS)
static volatile sig_atomic_t got_SIGHUP
static TimestampTz startup_progress_phase_start_time
static volatile sig_atomic_t promote_signaled
void PostRestoreCommand(void)
static void StartupProcTriggerHandler(SIGNAL_ARGS)
void StartupProcessMain(const void *startup_data, size_t startup_data_len)
int log_startup_progress_interval
void enable_startup_progress_timeout(void)
bool has_startup_progress_timeout_expired(long *secs, int *usecs)
static void StartupRereadConfig(void)
void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
TimestampTz GetCurrentTimestamp(void)
Datum now(PG_FUNCTION_ARGS)
volatile sig_atomic_t LogMemoryContextPending
volatile sig_atomic_t ProcSignalBarrierPending
void ProcessConfigFile(GucContext context)
Assert(PointerIsAligned(start, uint64))
void on_shmem_exit(pg_on_exit_callback function, Datum arg)
char * pstrdup(const char *in)
void pfree(void *pointer)
void ProcessLogMemoryContextInterrupt(void)
BackendType MyBackendType
#define PostmasterIsAlive()
void ProcessProcSignalBarrier(void)
void procsignal_sigusr1_handler(SIGNAL_ARGS)
void StandbyTimeoutHandler(void)
void StandbyLockTimeoutHandler(void)
void StandbyDeadLockHandler(void)
void ShutdownRecoveryTransactionEnvironment(void)
void InitializeTimeouts(void)
void enable_timeout_every(TimeoutId id, TimestampTz fin_time, int delay_ms)
void disable_timeout(TimeoutId id, bool keep_indicator)
TimeoutId RegisterTimeout(TimeoutId id, timeout_handler_proc handler)
@ STARTUP_PROGRESS_TIMEOUT
@ STANDBY_DEADLOCK_TIMEOUT
#define TimestampTzPlusMilliseconds(tz, ms)
void StartupRequestWalReceiverRestart(void)
void WakeupRecovery(void)
bool wal_receiver_create_temp_slot
HotStandbyState standbyState