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