94#define NumProcSignalSlots (MaxBackends + NUM_AUXILIARY_PROCS)
97#define BARRIER_SHOULD_CHECK(flags, type) \
98 (((flags) & (((uint32) 1) << (uint32) (type))) != 0)
101#define BARRIER_CLEAR_BIT(flags, type) \
102 ((flags) &= ~(((uint32) 1) << (uint32) (type)))
169 uint64 barrier_generation;
182 elog(
LOG,
"process %d taking over ProcSignal slot %d, but it's not empty",
248 elog(
LOG,
"process %d releasing ProcSignal slot %d, but it contains %d",
426 "waiting for all backends to process ProcSignalBarrier generation "
442 while (oldval < generation)
446 WAIT_EVENT_PROC_SIGNAL_BARRIER))
448 (
errmsg(
"still waiting for backend with PID %d to accept ProcSignalBarrier",
456 "finished waiting for all backends to process ProcSignalBarrier generation "
518 Assert(local_gen <= shared_gen);
520 if (local_gen == shared_gen)
568 bool processed =
true;
763 (
errmsg_internal(
"processing cancel request: sending SIGINT to process %d",
771 kill(-backendPID, SIGINT);
773 kill(backendPID, SIGINT);
780 (
errmsg(
"wrong key in cancel request for process %d",
789 (
errmsg(
"PID %d in cancel request did not match any process",
void HandleParallelApplyMessageInterrupt(void)
void HandleNotifyInterrupt(void)
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
static uint32 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)
#define pg_memory_barrier()
static void pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
static void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
static uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
static uint64 pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
static uint32 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
static uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
void HandleParallelMessageInterrupt(void)
#define Assert(condition)
#define FLEXIBLE_ARRAY_MEMBER
#define MemSet(start, val, len)
bool ConditionVariableCancelSleep(void)
bool ConditionVariableTimedSleep(ConditionVariable *cv, long timeout, uint32 wait_event_info)
void ConditionVariableBroadcast(ConditionVariable *cv)
void ConditionVariableInit(ConditionVariable *cv)
int errmsg_internal(const char *fmt,...)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
volatile sig_atomic_t ProcSignalBarrierPending
volatile sig_atomic_t InterruptPending
void on_shmem_exit(pg_on_exit_callback function, Datum arg)
void SetLatch(Latch *latch)
void HandleLogMemoryContextInterrupt(void)
static int pg_rightmost_one_pos32(uint32 word)
void HandleRecoveryConflictInterrupt(ProcSignalReason reason)
#define INVALID_PROC_NUMBER
void SendCancelRequest(int backendPID, int32 cancelAuthCode)
static void CleanupProcSignalState(int status, Datum arg)
int SendProcSignal(pid_t pid, ProcSignalReason reason, ProcNumber procNumber)
void ProcSignalShmemInit(void)
#define NumProcSignalSlots
static bool CheckProcSignal(ProcSignalReason reason)
void ProcessProcSignalBarrier(void)
void WaitForProcSignalBarrier(uint64 generation)
void ProcSignalInit(bool cancel_key_valid, int32 cancel_key)
NON_EXEC_STATIC ProcSignalHeader * ProcSignal
static void ResetProcSignalBarrierBits(uint32 flags)
uint64 EmitProcSignalBarrier(ProcSignalBarrierType type)
Size ProcSignalShmemSize(void)
static void HandleProcSignalBarrierInterrupt(void)
static ProcSignalSlot * MyProcSignalSlot
#define BARRIER_CLEAR_BIT(flags, type)
void procsignal_sigusr1_handler(SIGNAL_ARGS)
@ PROCSIG_PARALLEL_MESSAGE
@ PROCSIG_RECOVERY_CONFLICT_BUFFERPIN
@ PROCSIG_CATCHUP_INTERRUPT
@ PROCSIG_RECOVERY_CONFLICT_LOCK
@ PROCSIG_LOG_MEMORY_CONTEXT
@ PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT
@ PROCSIG_RECOVERY_CONFLICT_DATABASE
@ PROCSIG_WALSND_INIT_STOPPING
@ PROCSIG_PARALLEL_APPLY_MESSAGE
@ PROCSIG_RECOVERY_CONFLICT_SNAPSHOT
@ PROCSIG_NOTIFY_INTERRUPT
@ PROCSIG_RECOVERY_CONFLICT_TABLESPACE
@ PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK
@ PROCSIGNAL_BARRIER_SMGRRELEASE
Size add_size(Size s1, Size s2)
Size mul_size(Size s1, Size s2)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
void HandleCatchupInterrupt(void)
static pg_noinline void Size size
bool ProcessBarrierSmgrRelease(void)
#define SpinLockInit(lock)
#define SpinLockRelease(lock)
#define SpinLockAcquire(lock)
ConditionVariable pss_barrierCV
pg_atomic_uint64 pss_barrierGeneration
volatile sig_atomic_t pss_signalFlags[NUM_PROCSIGNALS]
bool pss_cancel_key_valid
pg_atomic_uint32 pss_barrierCheckMask
void HandleWalSndInitStopping(void)