PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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-2026, 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 "commands/async.h"
22#include "commands/repack.h"
23#include "miscadmin.h"
24#include "pgstat.h"
25#include "port/pg_bitutils.h"
32#include "storage/ipc.h"
33#include "storage/latch.h"
34#include "storage/proc.h"
35#include "storage/shmem.h"
36#include "storage/sinval.h"
37#include "storage/smgr.h"
38#include "storage/subsystems.h"
39#include "tcop/tcopprot.h"
40#include "utils/memutils.h"
41#include "utils/wait_event.h"
42
43/*
44 * The SIGUSR1 signal is multiplexed to support signaling multiple event
45 * types. The specific reason is communicated via flags in shared memory.
46 * We keep a boolean flag for each possible "reason", so that different
47 * reasons can be signaled to a process concurrently. (However, if the same
48 * reason is signaled more than once nearly simultaneously, the process may
49 * observe it only once.)
50 *
51 * Each process that wants to receive signals registers its process ID
52 * in the ProcSignalSlots array. The array is indexed by ProcNumber to make
53 * slot allocation simple, and to avoid having to search the array when you
54 * know the ProcNumber of the process you're signaling. (We do support
55 * signaling without ProcNumber, but it's a bit less efficient.)
56 *
57 * The fields in each slot are protected by a spinlock, pss_mutex. pss_pid can
58 * also be read without holding the spinlock, as a quick preliminary check
59 * when searching for a particular PID in the array.
60 *
61 * pss_signalFlags are intended to be set in cases where we don't need to
62 * keep track of whether or not the target process has handled the signal,
63 * but sometimes we need confirmation, as when making a global state change
64 * that cannot be considered complete until all backends have taken notice
65 * of it. For such use cases, we set a bit in pss_barrierCheckMask and then
66 * increment the current "barrier generation"; when the new barrier generation
67 * (or greater) appears in the pss_barrierGeneration flag of every process,
68 * we know that the message has been received everywhere.
69 */
70typedef struct
71{
73 int pss_cancel_key_len; /* 0 means no cancellation is possible */
75 volatile sig_atomic_t pss_signalFlags[NUM_PROCSIGNALS];
76 slock_t pss_mutex; /* protects the above fields */
77
78 /* Barrier-related fields (not protected by pss_mutex) */
83
84/*
85 * Information that is global to the entire ProcSignal system can be stored
86 * here.
87 *
88 * psh_barrierGeneration is the highest barrier generation in existence.
89 */
95
96/*
97 * We reserve a slot for each possible ProcNumber, plus one for each
98 * possible auxiliary process type. (This scheme assumes there is not
99 * more than one of any auxiliary process type at a time, except for
100 * IO workers.)
101 */
102#define NumProcSignalSlots (MaxBackends + NUM_AUXILIARY_PROCS)
103
104/* Check whether the relevant type bit is set in the flags. */
105#define BARRIER_SHOULD_CHECK(flags, type) \
106 (((flags) & (((uint32) 1) << (uint32) (type))) != 0)
107
108/* Clear the relevant type bit from the flags. */
109#define BARRIER_CLEAR_BIT(flags, type) \
110 ((flags) &= ~(((uint32) 1) << (uint32) (type)))
111
112static void ProcSignalShmemRequest(void *arg);
113static void ProcSignalShmemInit(void *arg);
114
119
121
123
124static bool CheckProcSignal(ProcSignalReason reason);
125static void CleanupProcSignalState(int status, Datum arg);
126static void ResetProcSignalBarrierBits(uint32 flags);
127
128/*
129 * ProcSignalShmemRequest
130 * Register ProcSignal's shared memory needs at postmaster startup
131 */
132static void
134{
135 Size size;
136
138 size = add_size(size, offsetof(ProcSignalHeader, psh_slot));
139
140 ShmemRequestStruct(.name = "ProcSignal",
141 .size = size,
142 .ptr = (void **) &ProcSignal,
143 );
144}
145
146static void
164
165/*
166 * ProcSignalInit
167 * Register the current process in the ProcSignal array
168 */
169void
171{
172 ProcSignalSlot *slot;
175
177 if (MyProcNumber < 0)
178 elog(ERROR, "MyProcNumber not set");
180 elog(ERROR, "unexpected MyProcNumber %d in ProcSignalInit (max %d)", MyProcNumber, NumProcSignalSlots);
182
184
185 /* Value used for sanity check below */
187
188 /* Clear out any leftover signal reasons */
190
191 /*
192 * Initialize barrier state. Since we're a brand-new process, there
193 * shouldn't be any leftover backend-private state that needs to be
194 * updated. Therefore, we can broadcast the latest barrier generation and
195 * disregard any previously-set check bits.
196 *
197 * NB: This only works if this initialization happens early enough in the
198 * startup sequence that we haven't yet cached any state that might need
199 * to be invalidated. That's also why we have a memory barrier here, to be
200 * sure that any later reads of memory happen strictly after this.
201 */
206
207 if (cancel_key_len > 0)
211
213
214 /* Spinlock is released, do the check */
215 if (old_pss_pid != 0)
216 elog(LOG, "process %d taking over ProcSignal slot %d, but it's not empty",
218
219 /* Remember slot location for CheckProcSignal */
220 MyProcSignalSlot = slot;
221
222 /* Set up to release the slot on process exit */
224}
225
226/*
227 * CleanupProcSignalState
228 * Remove current process from ProcSignal mechanism
229 *
230 * This function is called via on_shmem_exit() during backend shutdown.
231 */
232static void
234{
237
238 /*
239 * Clear MyProcSignalSlot, so that a SIGUSR1 received after this point
240 * won't try to access it after it's no longer ours (and perhaps even
241 * after we've unmapped the shared memory segment).
242 */
245
246 /* sanity check */
249 if (old_pid != MyProcPid)
250 {
251 /*
252 * don't ERROR here. We're exiting anyway, and don't want to get into
253 * infinite loop trying to exit
254 */
256 elog(LOG, "process %d releasing ProcSignal slot %d, but it contains %d",
257 MyProcPid, (int) (slot - ProcSignal->psh_slot), (int) old_pid);
258 return; /* XXX better to zero the slot anyway? */
259 }
260
261 /* Mark the slot as unused */
262 pg_atomic_write_u32(&slot->pss_pid, 0);
263 slot->pss_cancel_key_len = 0;
264
265 /*
266 * Make this slot look like it's absorbed all possible barriers, so that
267 * no barrier waits block on it.
268 */
270
272
274}
275
276/*
277 * SendProcSignal
278 * Send a signal to a Postgres process
279 *
280 * Providing procNumber is optional, but it will speed up the operation.
281 *
282 * On success (a signal was sent), zero is returned.
283 * On error, -1 is returned, and errno is set (typically to ESRCH or EPERM).
284 *
285 * Not to be confused with ProcSendSignal
286 */
287int
289{
290 volatile ProcSignalSlot *slot;
291
292 if (procNumber != INVALID_PROC_NUMBER)
293 {
294 Assert(procNumber < NumProcSignalSlots);
295 slot = &ProcSignal->psh_slot[procNumber];
296
298 if (pg_atomic_read_u32(&slot->pss_pid) == pid)
299 {
300 /* Atomically set the proper flag */
301 slot->pss_signalFlags[reason] = true;
303 /* Send signal */
304 return kill(pid, SIGUSR1);
305 }
307 }
308 else
309 {
310 /*
311 * procNumber not provided, so search the array using pid. We search
312 * the array back to front so as to reduce search overhead. Passing
313 * INVALID_PROC_NUMBER means that the target is most likely an
314 * auxiliary process, which will have a slot near the end of the
315 * array.
316 */
317 int i;
318
319 for (i = NumProcSignalSlots - 1; i >= 0; i--)
320 {
321 slot = &ProcSignal->psh_slot[i];
322
323 if (pg_atomic_read_u32(&slot->pss_pid) == pid)
324 {
326 if (pg_atomic_read_u32(&slot->pss_pid) == pid)
327 {
328 /* Atomically set the proper flag */
329 slot->pss_signalFlags[reason] = true;
331 /* Send signal */
332 return kill(pid, SIGUSR1);
333 }
335 }
336 }
337 }
338
339 errno = ESRCH;
340 return -1;
341}
342
343/*
344 * EmitProcSignalBarrier
345 * Send a signal to every Postgres process
346 *
347 * The return value of this function is the barrier "generation" created
348 * by this operation. This value can be passed to WaitForProcSignalBarrier
349 * to wait until it is known that every participant in the ProcSignal
350 * mechanism has absorbed the signal (or started afterwards).
351 *
352 * Note that it would be a bad idea to use this for anything that happens
353 * frequently, as interrupting every backend could cause a noticeable
354 * performance hit.
355 *
356 * Callers are entitled to assume that this function will not throw ERROR
357 * or FATAL.
358 */
359uint64
361{
362 uint32 flagbit = 1 << (uint32) type;
363 uint64 generation;
364
365 /*
366 * Set all the flags.
367 *
368 * Note that pg_atomic_fetch_or_u32 has full barrier semantics, so this is
369 * totally ordered with respect to anything the caller did before, and
370 * anything that we do afterwards. (This is also true of the later call to
371 * pg_atomic_add_fetch_u64.)
372 */
373 for (int i = 0; i < NumProcSignalSlots; i++)
374 {
375 volatile ProcSignalSlot *slot = &ProcSignal->psh_slot[i];
376
378 }
379
380 /*
381 * Increment the generation counter.
382 */
383 generation =
385
386 /*
387 * Signal all the processes, so that they update their advertised barrier
388 * generation.
389 *
390 * Concurrency is not a problem here. Backends that have exited don't
391 * matter, and new backends that have joined since we entered this
392 * function must already have current state, since the caller is
393 * responsible for making sure that the relevant state is entirely visible
394 * before calling this function in the first place. We still have to wake
395 * them up - because we can't distinguish between such backends and older
396 * backends that need to update state - but they won't actually need to
397 * change any state.
398 */
399 for (int i = NumProcSignalSlots - 1; i >= 0; i--)
400 {
401 volatile ProcSignalSlot *slot = &ProcSignal->psh_slot[i];
402 pid_t pid = pg_atomic_read_u32(&slot->pss_pid);
403
404 if (pid != 0)
405 {
407 pid = pg_atomic_read_u32(&slot->pss_pid);
408 if (pid != 0)
409 {
410 /* see SendProcSignal for details */
411 slot->pss_signalFlags[PROCSIG_BARRIER] = true;
413 kill(pid, SIGUSR1);
414 }
415 else
417 }
418 }
419
420 return generation;
421}
422
423/*
424 * WaitForProcSignalBarrier - wait until it is guaranteed that all changes
425 * requested by a specific call to EmitProcSignalBarrier() have taken effect.
426 */
427void
429{
431
432 elog(DEBUG1,
433 "waiting for all backends to process ProcSignalBarrier generation "
435 generation);
436
437 for (int i = NumProcSignalSlots - 1; i >= 0; i--)
438 {
441
442 /*
443 * It's important that we check only pss_barrierGeneration here and
444 * not pss_barrierCheckMask. Bits in pss_barrierCheckMask get cleared
445 * before the barrier is actually absorbed, but pss_barrierGeneration
446 * is updated only afterward.
447 */
449 while (oldval < generation)
450 {
452 5000,
454 ereport(LOG,
455 (errmsg("still waiting for backend with PID %d to accept ProcSignalBarrier",
456 (int) pg_atomic_read_u32(&slot->pss_pid))));
458 }
460 }
461
462 elog(DEBUG1,
463 "finished waiting for all backends to process ProcSignalBarrier generation "
465 generation);
466
467 /*
468 * The caller is probably calling this function because it wants to read
469 * the shared state or perform further writes to shared state once all
470 * backends are known to have absorbed the barrier. However, the read of
471 * pss_barrierGeneration was performed unlocked; insert a memory barrier
472 * to separate it from whatever follows.
473 */
475}
476
477/*
478 * Handle receipt of an interrupt indicating a global barrier event.
479 *
480 * All the actual work is deferred to ProcessProcSignalBarrier(), because we
481 * cannot safely access the barrier generation inside the signal handler as
482 * 64bit atomics might use spinlock based emulation, even for reads. As this
483 * routine only gets called when PROCSIG_BARRIER is sent that won't cause a
484 * lot of unnecessary work.
485 */
486static void
488{
489 InterruptPending = true;
491 /* latch will be set by procsignal_sigusr1_handler */
492}
493
494/*
495 * Perform global barrier related interrupt checking.
496 *
497 * Any backend that participates in ProcSignal signaling must arrange to
498 * call this function periodically. It is called from CHECK_FOR_INTERRUPTS(),
499 * which is enough for normal backends, but not necessarily for all types of
500 * background processes.
501 */
502void
504{
507 volatile uint32 flags;
508
510
511 /* Exit quickly if there's no work to do. */
513 return;
515
516 /*
517 * It's not unlikely to process multiple barriers at once, before the
518 * signals for all the barriers have arrived. To avoid unnecessary work in
519 * response to subsequent signals, exit early if we already have processed
520 * all of them.
521 */
524
526
527 if (local_gen == shared_gen)
528 return;
529
530 /*
531 * Get and clear the flags that are set for this backend. Note that
532 * pg_atomic_exchange_u32 is a full barrier, so we're guaranteed that the
533 * read of the barrier generation above happens before we atomically
534 * extract the flags, and that any subsequent state changes happen
535 * afterward.
536 *
537 * NB: In order to avoid race conditions, we must zero
538 * pss_barrierCheckMask first and only afterwards try to do barrier
539 * processing. If we did it in the other order, someone could send us
540 * another barrier of some type right after we called the
541 * barrier-processing function but before we cleared the bit. We would
542 * have no way of knowing that the bit needs to stay set in that case, so
543 * the need to call the barrier-processing function again would just get
544 * forgotten. So instead, we tentatively clear all the bits and then put
545 * back any for which we don't manage to successfully absorb the barrier.
546 */
548
549 /*
550 * If there are no flags set, then we can skip doing any real work.
551 * Otherwise, establish a PG_TRY block, so that we don't lose track of
552 * which types of barrier processing are needed if an ERROR occurs.
553 */
554 if (flags != 0)
555 {
556 bool success = true;
557
558 PG_TRY();
559 {
560 /*
561 * Process each type of barrier. The barrier-processing functions
562 * should normally return true, but may return false if the
563 * barrier can't be absorbed at the current time. This should be
564 * rare, because it's pretty expensive. Every single
565 * CHECK_FOR_INTERRUPTS() will return here until we manage to
566 * absorb the barrier, and that cost will add up in a hurry.
567 *
568 * NB: It ought to be OK to call the barrier-processing functions
569 * unconditionally, but it's more efficient to call only the ones
570 * that might need us to do something based on the flags.
571 */
572 while (flags != 0)
573 {
575 bool processed = true;
576
578 switch (type)
579 {
581 processed = ProcessBarrierSmgrRelease();
582 break;
585 break;
586
591 processed = AbsorbDataChecksumsBarrier(type);
592 break;
593 }
594
595 /*
596 * To avoid an infinite loop, we must always unset the bit in
597 * flags.
598 */
599 BARRIER_CLEAR_BIT(flags, type);
600
601 /*
602 * If we failed to process the barrier, reset the shared bit
603 * so we try again later, and set a flag so that we don't bump
604 * our generation.
605 */
606 if (!processed)
607 {
609 success = false;
610 }
611 }
612 }
613 PG_CATCH();
614 {
615 /*
616 * If an ERROR occurred, we'll need to try again later to handle
617 * that barrier type and any others that haven't been handled yet
618 * or weren't successfully absorbed.
619 */
621 PG_RE_THROW();
622 }
623 PG_END_TRY();
624
625 /*
626 * If some barrier types were not successfully absorbed, we will have
627 * to try again later.
628 */
629 if (!success)
630 return;
631 }
632
633 /*
634 * State changes related to all types of barriers that might have been
635 * emitted have now been handled, so we can update our notion of the
636 * generation to the one we observed before beginning the updates. If
637 * things have changed further, it'll get fixed up when this function is
638 * next called.
639 */
642}
643
644/*
645 * If it turns out that we couldn't absorb one or more barrier types, either
646 * because the barrier-processing functions returned false or due to an error,
647 * arrange for processing to be retried later.
648 */
649static void
656
657/*
658 * CheckProcSignal - check to see if a particular reason has been
659 * signaled, and clear the signal flag. Should be called after receiving
660 * SIGUSR1.
661 */
662static bool
664{
665 volatile ProcSignalSlot *slot = MyProcSignalSlot;
666
667 if (slot != NULL)
668 {
669 /*
670 * Careful here --- don't clear flag if we haven't seen it set.
671 * pss_signalFlags is of type "volatile sig_atomic_t" to allow us to
672 * read it here safely, without holding the spinlock.
673 */
674 if (slot->pss_signalFlags[reason])
675 {
676 slot->pss_signalFlags[reason] = false;
677 return true;
678 }
679 }
680
681 return false;
682}
683
684/*
685 * procsignal_sigusr1_handler - handle SIGUSR1 signal.
686 */
687void
722
723/*
724 * Send a query cancellation signal to backend.
725 *
726 * Note: This is called from a backend process before authentication. We
727 * cannot take LWLocks yet, but that's OK; we rely on atomic reads of the
728 * fields in the ProcSignal slots.
729 */
730void
732{
733 if (backendPID == 0)
734 {
735 ereport(LOG, (errmsg("invalid cancel request with PID 0")));
736 return;
737 }
738
739 /*
740 * See if we have a matching backend. Reading the pss_pid and
741 * pss_cancel_key fields is racy, a backend might die and remove itself
742 * from the array at any time. The probability of the cancellation key
743 * matching wrong process is miniscule, however, so we can live with that.
744 * PIDs are reused too, so sending the signal based on PID is inherently
745 * racy anyway, although OS's avoid reusing PIDs too soon.
746 */
747 for (int i = 0; i < NumProcSignalSlots; i++)
748 {
750 bool match;
751
752 if (pg_atomic_read_u32(&slot->pss_pid) != backendPID)
753 continue;
754
755 /* Acquire the spinlock and re-check */
757 if (pg_atomic_read_u32(&slot->pss_pid) != backendPID)
758 {
760 continue;
761 }
762 else
763 {
764 match = slot->pss_cancel_key_len == cancel_key_len &&
766
768
769 if (match)
770 {
771 /* Found a match; signal that backend to cancel current op */
773 (errmsg_internal("processing cancel request: sending SIGINT to process %d",
774 backendPID)));
775
776 /*
777 * If we have setsid(), signal the backend's whole process
778 * group
779 */
780#ifdef HAVE_SETSID
781 kill(-backendPID, SIGINT);
782#else
783 kill(backendPID, SIGINT);
784#endif
785 }
786 else
787 {
788 /* Right PID, wrong key: no way, Jose */
789 ereport(LOG,
790 (errmsg("wrong key in cancel request for process %d",
791 backendPID)));
792 }
793 return;
794 }
795 }
796
797 /* No matching backend */
798 ereport(LOG,
799 (errmsg("PID %d in cancel request did not match any process",
800 backendPID)));
801}
void HandleParallelApplyMessageInterrupt(void)
void HandleNotifyInterrupt(void)
Definition async.c:2550
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition atomics.h:485
static uint32 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)
Definition atomics.h:410
#define pg_memory_barrier()
Definition atomics.h:141
static void pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
Definition atomics.h:219
static void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
Definition atomics.h:274
static uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
Definition atomics.h:237
static uint64 pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
Definition atomics.h:569
static uint32 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)
Definition atomics.h:330
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition atomics.h:453
static uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
Definition atomics.h:467
void HandleParallelMessageInterrupt(void)
Definition parallel.c:1046
uint8_t uint8
Definition c.h:622
#define SIGNAL_ARGS
Definition c.h:1450
#define Assert(condition)
Definition c.h:943
#define FLEXIBLE_ARRAY_MEMBER
Definition c.h:558
#define UINT64_FORMAT
Definition c.h:635
uint64_t uint64
Definition c.h:625
uint32_t uint32
Definition c.h:624
#define PG_UINT64_MAX
Definition c.h:677
#define MemSet(start, val, len)
Definition c.h:1107
size_t Size
Definition c.h:689
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
bool ConditionVariableCancelSleep(void)
bool ConditionVariableTimedSleep(ConditionVariable *cv, long timeout, uint32 wait_event_info)
void ConditionVariableBroadcast(ConditionVariable *cv)
void ConditionVariableInit(ConditionVariable *cv)
bool AbsorbDataChecksumsBarrier(ProcSignalBarrierType barrier)
Datum arg
Definition elog.c:1322
#define LOG
Definition elog.h:32
#define PG_RE_THROW()
Definition elog.h:407
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
#define PG_TRY(...)
Definition elog.h:374
#define DEBUG2
Definition elog.h:30
#define PG_END_TRY(...)
Definition elog.h:399
#define DEBUG1
Definition elog.h:31
#define ERROR
Definition elog.h:40
#define PG_CATCH(...)
Definition elog.h:384
#define elog(elevel,...)
Definition elog.h:228
#define ereport(elevel,...)
Definition elog.h:152
volatile sig_atomic_t ProcSignalBarrierPending
Definition globals.c:40
volatile sig_atomic_t InterruptPending
Definition globals.c:32
int MyProcPid
Definition globals.c:49
ProcNumber MyProcNumber
Definition globals.c:92
struct Latch * MyLatch
Definition globals.c:65
static bool success
Definition initdb.c:188
void on_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition ipc.c:372
int i
Definition isn.c:77
void SetLatch(Latch *latch)
Definition latch.c:290
bool ProcessBarrierUpdateXLogLogicalInfo(void)
Definition logicalctl.c:184
void HandleLogMemoryContextInterrupt(void)
Definition mcxt.c:1323
static char * errmsg
static int pg_rightmost_one_pos32(uint32 word)
int timingsafe_bcmp(const void *b1, const void *b2, size_t n)
void HandleRecoveryConflictInterrupt(void)
Definition postgres.c:3086
uint64_t Datum
Definition postgres.h:70
#define NON_EXEC_STATIC
Definition postgres.h:560
static int fb(int x)
#define INVALID_PROC_NUMBER
Definition procnumber.h:26
int ProcNumber
Definition procnumber.h:24
static void CleanupProcSignalState(int status, Datum arg)
Definition procsignal.c:233
const ShmemCallbacks ProcSignalShmemCallbacks
Definition procsignal.c:115
int SendProcSignal(pid_t pid, ProcSignalReason reason, ProcNumber procNumber)
Definition procsignal.c:288
void ProcSignalInit(const uint8 *cancel_key, int cancel_key_len)
Definition procsignal.c:170
static void ProcSignalShmemInit(void *arg)
Definition procsignal.c:147
#define NumProcSignalSlots
Definition procsignal.c:102
static bool CheckProcSignal(ProcSignalReason reason)
Definition procsignal.c:663
void ProcessProcSignalBarrier(void)
Definition procsignal.c:503
void WaitForProcSignalBarrier(uint64 generation)
Definition procsignal.c:428
NON_EXEC_STATIC ProcSignalHeader * ProcSignal
Definition procsignal.c:120
static void ResetProcSignalBarrierBits(uint32 flags)
Definition procsignal.c:650
void SendCancelRequest(int backendPID, const uint8 *cancel_key, int cancel_key_len)
Definition procsignal.c:731
uint64 EmitProcSignalBarrier(ProcSignalBarrierType type)
Definition procsignal.c:360
static void ProcSignalShmemRequest(void *arg)
Definition procsignal.c:133
static void HandleProcSignalBarrierInterrupt(void)
Definition procsignal.c:487
static ProcSignalSlot * MyProcSignalSlot
Definition procsignal.c:122
#define BARRIER_CLEAR_BIT(flags, type)
Definition procsignal.c:109
void procsignal_sigusr1_handler(SIGNAL_ARGS)
Definition procsignal.c:688
#define NUM_PROCSIGNALS
Definition procsignal.h:46
ProcSignalReason
Definition procsignal.h:31
@ PROCSIG_RECOVERY_CONFLICT
Definition procsignal.h:41
@ PROCSIG_PARALLEL_MESSAGE
Definition procsignal.h:34
@ PROCSIG_CATCHUP_INTERRUPT
Definition procsignal.h:32
@ PROCSIG_SLOTSYNC_MESSAGE
Definition procsignal.h:39
@ PROCSIG_LOG_MEMORY_CONTEXT
Definition procsignal.h:37
@ PROCSIG_BARRIER
Definition procsignal.h:36
@ PROCSIG_REPACK_MESSAGE
Definition procsignal.h:40
@ PROCSIG_WALSND_INIT_STOPPING
Definition procsignal.h:35
@ PROCSIG_PARALLEL_APPLY_MESSAGE
Definition procsignal.h:38
@ PROCSIG_NOTIFY_INTERRUPT
Definition procsignal.h:33
ProcSignalBarrierType
Definition procsignal.h:49
@ PROCSIGNAL_BARRIER_CHECKSUM_INPROGRESS_OFF
Definition procsignal.h:55
@ PROCSIGNAL_BARRIER_SMGRRELEASE
Definition procsignal.h:50
@ PROCSIGNAL_BARRIER_CHECKSUM_INPROGRESS_ON
Definition procsignal.h:54
@ PROCSIGNAL_BARRIER_UPDATE_XLOG_LOGICAL_INFO
Definition procsignal.h:51
@ PROCSIGNAL_BARRIER_CHECKSUM_ON
Definition procsignal.h:56
@ PROCSIGNAL_BARRIER_CHECKSUM_OFF
Definition procsignal.h:53
#define MAX_CANCEL_KEY_LENGTH
Definition procsignal.h:67
void HandleRepackMessageInterrupt(void)
Definition repack.c:3504
Size add_size(Size s1, Size s2)
Definition shmem.c:1048
Size mul_size(Size s1, Size s2)
Definition shmem.c:1063
#define ShmemRequestStruct(...)
Definition shmem.h:176
void HandleCatchupInterrupt(void)
Definition sinval.c:154
void HandleSlotSyncMessageInterrupt(void)
Definition slotsync.c:1319
bool ProcessBarrierSmgrRelease(void)
Definition smgr.c:1027
static void SpinLockRelease(volatile slock_t *lock)
Definition spin.h:62
static void SpinLockAcquire(volatile slock_t *lock)
Definition spin.h:56
static void SpinLockInit(volatile slock_t *lock)
Definition spin.h:50
ProcSignalSlot psh_slot[FLEXIBLE_ARRAY_MEMBER]
Definition procsignal.c:93
pg_atomic_uint64 psh_barrierGeneration
Definition procsignal.c:92
uint8 pss_cancel_key[MAX_CANCEL_KEY_LENGTH]
Definition procsignal.c:74
ConditionVariable pss_barrierCV
Definition procsignal.c:81
pg_atomic_uint64 pss_barrierGeneration
Definition procsignal.c:79
volatile sig_atomic_t pss_signalFlags[NUM_PROCSIGNALS]
Definition procsignal.c:75
slock_t pss_mutex
Definition procsignal.c:76
pg_atomic_uint32 pss_pid
Definition procsignal.c:72
int pss_cancel_key_len
Definition procsignal.c:73
pg_atomic_uint32 pss_barrierCheckMask
Definition procsignal.c:80
ShmemRequestCallback request_fn
Definition shmem.h:133
const char * type
const char * name
void HandleWalSndInitStopping(void)
Definition walsender.c:3860
#define kill(pid, sig)
Definition win32_port.h:490
#define SIGUSR1
Definition win32_port.h:170