PostgreSQL Source Code  git master
procsignal.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * procsignal.c
4  * Routines for interprocess signaling
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * IDENTIFICATION
11  * src/backend/storage/ipc/procsignal.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16 
17 #include <signal.h>
18 #include <unistd.h>
19 
20 #include "access/parallel.h"
21 #include "port/pg_bitutils.h"
22 #include "commands/async.h"
23 #include "miscadmin.h"
24 #include "pgstat.h"
26 #include "replication/walsender.h"
28 #include "storage/ipc.h"
29 #include "storage/latch.h"
30 #include "storage/proc.h"
31 #include "storage/shmem.h"
32 #include "storage/smgr.h"
33 #include "storage/sinval.h"
34 #include "tcop/tcopprot.h"
35 #include "utils/memutils.h"
36 
37 /*
38  * The SIGUSR1 signal is multiplexed to support signaling multiple event
39  * types. The specific reason is communicated via flags in shared memory.
40  * We keep a boolean flag for each possible "reason", so that different
41  * reasons can be signaled to a process concurrently. (However, if the same
42  * reason is signaled more than once nearly simultaneously, the process may
43  * observe it only once.)
44  *
45  * Each process that wants to receive signals registers its process ID
46  * in the ProcSignalSlots array. The array is indexed by backend ID to make
47  * slot allocation simple, and to avoid having to search the array when you
48  * know the backend ID of the process you're signaling. (We do support
49  * signaling without backend ID, but it's a bit less efficient.)
50  *
51  * The flags are actually declared as "volatile sig_atomic_t" for maximum
52  * portability. This should ensure that loads and stores of the flag
53  * values are atomic, allowing us to dispense with any explicit locking.
54  *
55  * pss_signalFlags are intended to be set in cases where we don't need to
56  * keep track of whether or not the target process has handled the signal,
57  * but sometimes we need confirmation, as when making a global state change
58  * that cannot be considered complete until all backends have taken notice
59  * of it. For such use cases, we set a bit in pss_barrierCheckMask and then
60  * increment the current "barrier generation"; when the new barrier generation
61  * (or greater) appears in the pss_barrierGeneration flag of every process,
62  * we know that the message has been received everywhere.
63  */
64 typedef struct
65 {
66  volatile pid_t pss_pid;
67  volatile sig_atomic_t pss_signalFlags[NUM_PROCSIGNALS];
72 
73 /*
74  * Information that is global to the entire ProcSignal system can be stored
75  * here.
76  *
77  * psh_barrierGeneration is the highest barrier generation in existence.
78  */
79 typedef struct
80 {
84 
85 /*
86  * We reserve a slot for each possible BackendId, plus one for each
87  * possible auxiliary process type. (This scheme assumes there is not
88  * more than one of any auxiliary process type at a time.)
89  */
90 #define NumProcSignalSlots (MaxBackends + NUM_AUXPROCTYPES)
91 
92 /* Check whether the relevant type bit is set in the flags. */
93 #define BARRIER_SHOULD_CHECK(flags, type) \
94  (((flags) & (((uint32) 1) << (uint32) (type))) != 0)
95 
96 /* Clear the relevant type bit from the flags. */
97 #define BARRIER_CLEAR_BIT(flags, type) \
98  ((flags) &= ~(((uint32) 1) << (uint32) (type)))
99 
102 
103 static bool CheckProcSignal(ProcSignalReason reason);
104 static void CleanupProcSignalState(int status, Datum arg);
105 static void ResetProcSignalBarrierBits(uint32 flags);
106 
107 /*
108  * ProcSignalShmemSize
109  * Compute space needed for ProcSignal's shared memory
110  */
111 Size
113 {
114  Size size;
115 
116  size = mul_size(NumProcSignalSlots, sizeof(ProcSignalSlot));
117  size = add_size(size, offsetof(ProcSignalHeader, psh_slot));
118  return size;
119 }
120 
121 /*
122  * ProcSignalShmemInit
123  * Allocate and initialize ProcSignal's shared memory
124  */
125 void
127 {
128  Size size = ProcSignalShmemSize();
129  bool found;
130 
132  ShmemInitStruct("ProcSignal", size, &found);
133 
134  /* If we're first, initialize. */
135  if (!found)
136  {
137  int i;
138 
140 
141  for (i = 0; i < NumProcSignalSlots; ++i)
142  {
143  ProcSignalSlot *slot = &ProcSignal->psh_slot[i];
144 
145  slot->pss_pid = 0;
146  MemSet(slot->pss_signalFlags, 0, sizeof(slot->pss_signalFlags));
150  }
151  }
152 }
153 
154 /*
155  * ProcSignalInit
156  * Register the current process in the ProcSignal array
157  *
158  * The passed index should be my BackendId if the process has one,
159  * or MaxBackends + aux process type if not.
160  */
161 void
162 ProcSignalInit(int pss_idx)
163 {
164  ProcSignalSlot *slot;
165  uint64 barrier_generation;
166 
167  Assert(pss_idx >= 1 && pss_idx <= NumProcSignalSlots);
168 
169  slot = &ProcSignal->psh_slot[pss_idx - 1];
170 
171  /* sanity check */
172  if (slot->pss_pid != 0)
173  elog(LOG, "process %d taking over ProcSignal slot %d, but it's not empty",
174  MyProcPid, pss_idx);
175 
176  /* Clear out any leftover signal reasons */
177  MemSet(slot->pss_signalFlags, 0, NUM_PROCSIGNALS * sizeof(sig_atomic_t));
178 
179  /*
180  * Initialize barrier state. Since we're a brand-new process, there
181  * shouldn't be any leftover backend-private state that needs to be
182  * updated. Therefore, we can broadcast the latest barrier generation and
183  * disregard any previously-set check bits.
184  *
185  * NB: This only works if this initialization happens early enough in the
186  * startup sequence that we haven't yet cached any state that might need
187  * to be invalidated. That's also why we have a memory barrier here, to be
188  * sure that any later reads of memory happen strictly after this.
189  */
191  barrier_generation =
193  pg_atomic_write_u64(&slot->pss_barrierGeneration, barrier_generation);
195 
196  /* Mark slot with my PID */
197  slot->pss_pid = MyProcPid;
198 
199  /* Remember slot location for CheckProcSignal */
200  MyProcSignalSlot = slot;
201 
202  /* Set up to release the slot on process exit */
204 }
205 
206 /*
207  * CleanupProcSignalState
208  * Remove current process from ProcSignal mechanism
209  *
210  * This function is called via on_shmem_exit() during backend shutdown.
211  */
212 static void
214 {
215  int pss_idx = DatumGetInt32(arg);
216  ProcSignalSlot *slot;
217 
218  slot = &ProcSignal->psh_slot[pss_idx - 1];
219  Assert(slot == MyProcSignalSlot);
220 
221  /*
222  * Clear MyProcSignalSlot, so that a SIGUSR1 received after this point
223  * won't try to access it after it's no longer ours (and perhaps even
224  * after we've unmapped the shared memory segment).
225  */
226  MyProcSignalSlot = NULL;
227 
228  /* sanity check */
229  if (slot->pss_pid != MyProcPid)
230  {
231  /*
232  * don't ERROR here. We're exiting anyway, and don't want to get into
233  * infinite loop trying to exit
234  */
235  elog(LOG, "process %d releasing ProcSignal slot %d, but it contains %d",
236  MyProcPid, pss_idx, (int) slot->pss_pid);
237  return; /* XXX better to zero the slot anyway? */
238  }
239 
240  /*
241  * Make this slot look like it's absorbed all possible barriers, so that
242  * no barrier waits block on it.
243  */
246 
247  slot->pss_pid = 0;
248 }
249 
250 /*
251  * SendProcSignal
252  * Send a signal to a Postgres process
253  *
254  * Providing backendId is optional, but it will speed up the operation.
255  *
256  * On success (a signal was sent), zero is returned.
257  * On error, -1 is returned, and errno is set (typically to ESRCH or EPERM).
258  *
259  * Not to be confused with ProcSendSignal
260  */
261 int
262 SendProcSignal(pid_t pid, ProcSignalReason reason, BackendId backendId)
263 {
264  volatile ProcSignalSlot *slot;
265 
266  if (backendId != InvalidBackendId)
267  {
268  slot = &ProcSignal->psh_slot[backendId - 1];
269 
270  /*
271  * Note: Since there's no locking, it's possible that the target
272  * process detaches from shared memory and exits right after this
273  * test, before we set the flag and send signal. And the signal slot
274  * might even be recycled by a new process, so it's remotely possible
275  * that we set a flag for a wrong process. That's OK, all the signals
276  * are such that no harm is done if they're mistakenly fired.
277  */
278  if (slot->pss_pid == pid)
279  {
280  /* Atomically set the proper flag */
281  slot->pss_signalFlags[reason] = true;
282  /* Send signal */
283  return kill(pid, SIGUSR1);
284  }
285  }
286  else
287  {
288  /*
289  * BackendId not provided, so search the array using pid. We search
290  * the array back to front so as to reduce search overhead. Passing
291  * InvalidBackendId means that the target is most likely an auxiliary
292  * process, which will have a slot near the end of the array.
293  */
294  int i;
295 
296  for (i = NumProcSignalSlots - 1; i >= 0; i--)
297  {
298  slot = &ProcSignal->psh_slot[i];
299 
300  if (slot->pss_pid == pid)
301  {
302  /* the above note about race conditions applies here too */
303 
304  /* Atomically set the proper flag */
305  slot->pss_signalFlags[reason] = true;
306  /* Send signal */
307  return kill(pid, SIGUSR1);
308  }
309  }
310  }
311 
312  errno = ESRCH;
313  return -1;
314 }
315 
316 /*
317  * EmitProcSignalBarrier
318  * Send a signal to every Postgres process
319  *
320  * The return value of this function is the barrier "generation" created
321  * by this operation. This value can be passed to WaitForProcSignalBarrier
322  * to wait until it is known that every participant in the ProcSignal
323  * mechanism has absorbed the signal (or started afterwards).
324  *
325  * Note that it would be a bad idea to use this for anything that happens
326  * frequently, as interrupting every backend could cause a noticeable
327  * performance hit.
328  *
329  * Callers are entitled to assume that this function will not throw ERROR
330  * or FATAL.
331  */
332 uint64
334 {
335  uint32 flagbit = 1 << (uint32) type;
336  uint64 generation;
337 
338  /*
339  * Set all the flags.
340  *
341  * Note that pg_atomic_fetch_or_u32 has full barrier semantics, so this is
342  * totally ordered with respect to anything the caller did before, and
343  * anything that we do afterwards. (This is also true of the later call to
344  * pg_atomic_add_fetch_u64.)
345  */
346  for (int i = 0; i < NumProcSignalSlots; i++)
347  {
348  volatile ProcSignalSlot *slot = &ProcSignal->psh_slot[i];
349 
351  }
352 
353  /*
354  * Increment the generation counter.
355  */
356  generation =
358 
359  /*
360  * Signal all the processes, so that they update their advertised barrier
361  * generation.
362  *
363  * Concurrency is not a problem here. Backends that have exited don't
364  * matter, and new backends that have joined since we entered this
365  * function must already have current state, since the caller is
366  * responsible for making sure that the relevant state is entirely visible
367  * before calling this function in the first place. We still have to wake
368  * them up - because we can't distinguish between such backends and older
369  * backends that need to update state - but they won't actually need to
370  * change any state.
371  */
372  for (int i = NumProcSignalSlots - 1; i >= 0; i--)
373  {
374  volatile ProcSignalSlot *slot = &ProcSignal->psh_slot[i];
375  pid_t pid = slot->pss_pid;
376 
377  if (pid != 0)
378  {
379  /* see SendProcSignal for details */
380  slot->pss_signalFlags[PROCSIG_BARRIER] = true;
381  kill(pid, SIGUSR1);
382  }
383  }
384 
385  return generation;
386 }
387 
388 /*
389  * WaitForProcSignalBarrier - wait until it is guaranteed that all changes
390  * requested by a specific call to EmitProcSignalBarrier() have taken effect.
391  */
392 void
393 WaitForProcSignalBarrier(uint64 generation)
394 {
396 
397  elog(DEBUG1,
398  "waiting for all backends to process ProcSignalBarrier generation "
400  generation);
401 
402  for (int i = NumProcSignalSlots - 1; i >= 0; i--)
403  {
404  ProcSignalSlot *slot = &ProcSignal->psh_slot[i];
405  uint64 oldval;
406 
407  /*
408  * It's important that we check only pss_barrierGeneration here and
409  * not pss_barrierCheckMask. Bits in pss_barrierCheckMask get cleared
410  * before the barrier is actually absorbed, but pss_barrierGeneration
411  * is updated only afterward.
412  */
413  oldval = pg_atomic_read_u64(&slot->pss_barrierGeneration);
414  while (oldval < generation)
415  {
417  5000,
418  WAIT_EVENT_PROC_SIGNAL_BARRIER))
419  ereport(LOG,
420  (errmsg("still waiting for backend with PID %d to accept ProcSignalBarrier",
421  (int) slot->pss_pid)));
422  oldval = pg_atomic_read_u64(&slot->pss_barrierGeneration);
423  }
425  }
426 
427  elog(DEBUG1,
428  "finished waiting for all backends to process ProcSignalBarrier generation "
430  generation);
431 
432  /*
433  * The caller is probably calling this function because it wants to read
434  * the shared state or perform further writes to shared state once all
435  * backends are known to have absorbed the barrier. However, the read of
436  * pss_barrierGeneration was performed unlocked; insert a memory barrier
437  * to separate it from whatever follows.
438  */
440 }
441 
442 /*
443  * Handle receipt of an interrupt indicating a global barrier event.
444  *
445  * All the actual work is deferred to ProcessProcSignalBarrier(), because we
446  * cannot safely access the barrier generation inside the signal handler as
447  * 64bit atomics might use spinlock based emulation, even for reads. As this
448  * routine only gets called when PROCSIG_BARRIER is sent that won't cause a
449  * lot of unnecessary work.
450  */
451 static void
453 {
454  InterruptPending = true;
456  /* latch will be set by procsignal_sigusr1_handler */
457 }
458 
459 /*
460  * Perform global barrier related interrupt checking.
461  *
462  * Any backend that participates in ProcSignal signaling must arrange to
463  * call this function periodically. It is called from CHECK_FOR_INTERRUPTS(),
464  * which is enough for normal backends, but not necessarily for all types of
465  * background processes.
466  */
467 void
469 {
470  uint64 local_gen;
471  uint64 shared_gen;
472  volatile uint32 flags;
473 
475 
476  /* Exit quickly if there's no work to do. */
478  return;
479  ProcSignalBarrierPending = false;
480 
481  /*
482  * It's not unlikely to process multiple barriers at once, before the
483  * signals for all the barriers have arrived. To avoid unnecessary work in
484  * response to subsequent signals, exit early if we already have processed
485  * all of them.
486  */
489 
490  Assert(local_gen <= shared_gen);
491 
492  if (local_gen == shared_gen)
493  return;
494 
495  /*
496  * Get and clear the flags that are set for this backend. Note that
497  * pg_atomic_exchange_u32 is a full barrier, so we're guaranteed that the
498  * read of the barrier generation above happens before we atomically
499  * extract the flags, and that any subsequent state changes happen
500  * afterward.
501  *
502  * NB: In order to avoid race conditions, we must zero
503  * pss_barrierCheckMask first and only afterwards try to do barrier
504  * processing. If we did it in the other order, someone could send us
505  * another barrier of some type right after we called the
506  * barrier-processing function but before we cleared the bit. We would
507  * have no way of knowing that the bit needs to stay set in that case, so
508  * the need to call the barrier-processing function again would just get
509  * forgotten. So instead, we tentatively clear all the bits and then put
510  * back any for which we don't manage to successfully absorb the barrier.
511  */
513 
514  /*
515  * If there are no flags set, then we can skip doing any real work.
516  * Otherwise, establish a PG_TRY block, so that we don't lose track of
517  * which types of barrier processing are needed if an ERROR occurs.
518  */
519  if (flags != 0)
520  {
521  bool success = true;
522 
523  PG_TRY();
524  {
525  /*
526  * Process each type of barrier. The barrier-processing functions
527  * should normally return true, but may return false if the
528  * barrier can't be absorbed at the current time. This should be
529  * rare, because it's pretty expensive. Every single
530  * CHECK_FOR_INTERRUPTS() will return here until we manage to
531  * absorb the barrier, and that cost will add up in a hurry.
532  *
533  * NB: It ought to be OK to call the barrier-processing functions
534  * unconditionally, but it's more efficient to call only the ones
535  * that might need us to do something based on the flags.
536  */
537  while (flags != 0)
538  {
540  bool processed = true;
541 
543  switch (type)
544  {
546  processed = ProcessBarrierSmgrRelease();
547  break;
548  }
549 
550  /*
551  * To avoid an infinite loop, we must always unset the bit in
552  * flags.
553  */
554  BARRIER_CLEAR_BIT(flags, type);
555 
556  /*
557  * If we failed to process the barrier, reset the shared bit
558  * so we try again later, and set a flag so that we don't bump
559  * our generation.
560  */
561  if (!processed)
562  {
564  success = false;
565  }
566  }
567  }
568  PG_CATCH();
569  {
570  /*
571  * If an ERROR occurred, we'll need to try again later to handle
572  * that barrier type and any others that haven't been handled yet
573  * or weren't successfully absorbed.
574  */
576  PG_RE_THROW();
577  }
578  PG_END_TRY();
579 
580  /*
581  * If some barrier types were not successfully absorbed, we will have
582  * to try again later.
583  */
584  if (!success)
585  return;
586  }
587 
588  /*
589  * State changes related to all types of barriers that might have been
590  * emitted have now been handled, so we can update our notion of the
591  * generation to the one we observed before beginning the updates. If
592  * things have changed further, it'll get fixed up when this function is
593  * next called.
594  */
597 }
598 
599 /*
600  * If it turns out that we couldn't absorb one or more barrier types, either
601  * because the barrier-processing functions returned false or due to an error,
602  * arrange for processing to be retried later.
603  */
604 static void
606 {
609  InterruptPending = true;
610 }
611 
612 /*
613  * CheckProcSignal - check to see if a particular reason has been
614  * signaled, and clear the signal flag. Should be called after receiving
615  * SIGUSR1.
616  */
617 static bool
619 {
620  volatile ProcSignalSlot *slot = MyProcSignalSlot;
621 
622  if (slot != NULL)
623  {
624  /* Careful here --- don't clear flag if we haven't seen it set */
625  if (slot->pss_signalFlags[reason])
626  {
627  slot->pss_signalFlags[reason] = false;
628  return true;
629  }
630  }
631 
632  return false;
633 }
634 
635 /*
636  * procsignal_sigusr1_handler - handle SIGUSR1 signal.
637  */
638 void
640 {
643 
646 
649 
652 
655 
658 
661 
664 
667 
670 
673 
676 
679 
682 
683  SetLatch(MyLatch);
684 }
void HandleParallelApplyMessageInterrupt(void)
void HandleNotifyInterrupt(void)
Definition: async.c:1796
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition: atomics.h:433
static uint32 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)
Definition: atomics.h:367
#define pg_memory_barrier()
Definition: atomics.h:140
static void pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
Definition: atomics.h:218
static void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
Definition: atomics.h:253
static uint64 pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
Definition: atomics.h:499
static uint32 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)
Definition: atomics.h:287
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition: atomics.h:410
static uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
Definition: atomics.h:424
void HandleParallelMessageInterrupt(void)
Definition: parallel.c:1019
int BackendId
Definition: backendid.h:21
#define InvalidBackendId
Definition: backendid.h:23
unsigned int uint32
Definition: c.h:495
#define SIGNAL_ARGS
Definition: c.h:1334
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:387
#define UINT64_FORMAT
Definition: c.h:538
#define PG_UINT64_MAX
Definition: c.h:582
#define MemSet(start, val, len)
Definition: c.h:1009
size_t Size
Definition: c.h:594
bool ConditionVariableCancelSleep(void)
bool ConditionVariableTimedSleep(ConditionVariable *cv, long timeout, uint32 wait_event_info)
void ConditionVariableBroadcast(ConditionVariable *cv)
void ConditionVariableInit(ConditionVariable *cv)
int errmsg(const char *fmt,...)
Definition: elog.c:1075
#define LOG
Definition: elog.h:31
#define PG_RE_THROW()
Definition: elog.h:411
#define PG_TRY(...)
Definition: elog.h:370
#define PG_END_TRY(...)
Definition: elog.h:395
#define DEBUG1
Definition: elog.h:30
#define PG_CATCH(...)
Definition: elog.h:380
#define ereport(elevel,...)
Definition: elog.h:149
volatile sig_atomic_t ProcSignalBarrierPending
Definition: globals.c:38
volatile sig_atomic_t InterruptPending
Definition: globals.c:30
int MyProcPid
Definition: globals.c:45
struct Latch * MyLatch
Definition: globals.c:59
static bool success
Definition: initdb.c:184
void on_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition: ipc.c:365
int i
Definition: isn.c:73
void SetLatch(Latch *latch)
Definition: latch.c:633
Assert(fmt[strlen(fmt) - 1] !='\n')
void HandleLogMemoryContextInterrupt(void)
Definition: mcxt.c:1157
void * arg
static int pg_rightmost_one_pos32(uint32 word)
Definition: pg_bitutils.h:111
void HandleRecoveryConflictInterrupt(ProcSignalReason reason)
Definition: postgres.c:3034
uintptr_t Datum
Definition: postgres.h:64
static Datum Int32GetDatum(int32 X)
Definition: postgres.h:212
static int32 DatumGetInt32(Datum X)
Definition: postgres.h:202
static void CleanupProcSignalState(int status, Datum arg)
Definition: procsignal.c:213
static ProcSignalHeader * ProcSignal
Definition: procsignal.c:100
void ProcSignalShmemInit(void)
Definition: procsignal.c:126
#define NumProcSignalSlots
Definition: procsignal.c:90
static bool CheckProcSignal(ProcSignalReason reason)
Definition: procsignal.c:618
void ProcessProcSignalBarrier(void)
Definition: procsignal.c:468
void WaitForProcSignalBarrier(uint64 generation)
Definition: procsignal.c:393
int SendProcSignal(pid_t pid, ProcSignalReason reason, BackendId backendId)
Definition: procsignal.c:262
void ProcSignalInit(int pss_idx)
Definition: procsignal.c:162
static void ResetProcSignalBarrierBits(uint32 flags)
Definition: procsignal.c:605
uint64 EmitProcSignalBarrier(ProcSignalBarrierType type)
Definition: procsignal.c:333
Size ProcSignalShmemSize(void)
Definition: procsignal.c:112
static void HandleProcSignalBarrierInterrupt(void)
Definition: procsignal.c:452
static ProcSignalSlot * MyProcSignalSlot
Definition: procsignal.c:101
#define BARRIER_CLEAR_BIT(flags, type)
Definition: procsignal.c:97
void procsignal_sigusr1_handler(SIGNAL_ARGS)
Definition: procsignal.c:639
ProcSignalReason
Definition: procsignal.h:31
@ PROCSIG_PARALLEL_MESSAGE
Definition: procsignal.h:34
@ PROCSIG_RECOVERY_CONFLICT_BUFFERPIN
Definition: procsignal.h:47
@ PROCSIG_CATCHUP_INTERRUPT
Definition: procsignal.h:32
@ PROCSIG_RECOVERY_CONFLICT_LOCK
Definition: procsignal.h:44
@ PROCSIG_LOG_MEMORY_CONTEXT
Definition: procsignal.h:37
@ PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT
Definition: procsignal.h:46
@ PROCSIG_BARRIER
Definition: procsignal.h:36
@ PROCSIG_RECOVERY_CONFLICT_DATABASE
Definition: procsignal.h:42
@ PROCSIG_WALSND_INIT_STOPPING
Definition: procsignal.h:35
@ PROCSIG_PARALLEL_APPLY_MESSAGE
Definition: procsignal.h:38
@ PROCSIG_RECOVERY_CONFLICT_SNAPSHOT
Definition: procsignal.h:45
@ PROCSIG_NOTIFY_INTERRUPT
Definition: procsignal.h:33
@ PROCSIG_RECOVERY_CONFLICT_TABLESPACE
Definition: procsignal.h:43
@ NUM_PROCSIGNALS
Definition: procsignal.h:51
@ PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK
Definition: procsignal.h:48
ProcSignalBarrierType
Definition: procsignal.h:55
@ PROCSIGNAL_BARRIER_SMGRRELEASE
Definition: procsignal.h:56
Size add_size(Size s1, Size s2)
Definition: shmem.c:494
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
Definition: shmem.c:388
Size mul_size(Size s1, Size s2)
Definition: shmem.c:511
void HandleCatchupInterrupt(void)
Definition: sinval.c:156
bool ProcessBarrierSmgrRelease(void)
Definition: smgr.c:788
ProcSignalSlot psh_slot[FLEXIBLE_ARRAY_MEMBER]
Definition: procsignal.c:82
pg_atomic_uint64 psh_barrierGeneration
Definition: procsignal.c:81
ConditionVariable pss_barrierCV
Definition: procsignal.c:70
pg_atomic_uint64 pss_barrierGeneration
Definition: procsignal.c:68
volatile pid_t pss_pid
Definition: procsignal.c:66
volatile sig_atomic_t pss_signalFlags[NUM_PROCSIGNALS]
Definition: procsignal.c:67
pg_atomic_uint32 pss_barrierCheckMask
Definition: procsignal.c:69
const char * type
void HandleWalSndInitStopping(void)
Definition: walsender.c:3455
#define kill(pid, sig)
Definition: win32_port.h:485
#define SIGUSR1
Definition: win32_port.h:180