PostgreSQL Source Code git master
|
Go to the source code of this file.
Data Structures | |
struct | RegisteredBgWorker |
Macros | |
#define | MAX_PARALLEL_WORKER_LIMIT 1024 |
Typedefs | |
typedef struct RegisteredBgWorker | RegisteredBgWorker |
Functions | |
Size | BackgroundWorkerShmemSize (void) |
void | BackgroundWorkerShmemInit (void) |
void | BackgroundWorkerStateChange (bool allow_new_workers) |
void | ForgetBackgroundWorker (RegisteredBgWorker *rw) |
void | ReportBackgroundWorkerPID (RegisteredBgWorker *rw) |
void | ReportBackgroundWorkerExit (RegisteredBgWorker *rw) |
void | BackgroundWorkerStopNotifications (pid_t pid) |
void | ForgetUnstartedBackgroundWorkers (void) |
void | ResetBackgroundWorkerCrashTimes (void) |
pg_noreturn void | BackgroundWorkerMain (const void *startup_data, size_t startup_data_len) |
Variables | |
PGDLLIMPORT dlist_head | BackgroundWorkerList |
#define MAX_PARALLEL_WORKER_LIMIT 1024 |
Definition at line 24 of file bgworker_internals.h.
typedef struct RegisteredBgWorker RegisteredBgWorker |
pg_noreturn void BackgroundWorkerMain | ( | const void * | startup_data, |
size_t | startup_data_len | ||
) |
Definition at line 717 of file bgworker.c.
References Assert(), B_BG_WORKER, BackgroundWorkerUnblockSignals(), BaseInit(), BackgroundWorker::bgw_flags, BackgroundWorker::bgw_function_name, BackgroundWorker::bgw_library_name, BackgroundWorker::bgw_main_arg, BackgroundWorker::bgw_name, BGWORKER_BACKEND_DATABASE_CONNECTION, bgworker_die(), elog, EmitErrorReport(), error_context_stack, FATAL, FloatExceptionHandler(), GetProcessingMode, HOLD_INTERRUPTS, init_ps_display(), InitializeTimeouts(), InitProcess(), InitProcessing, LookupBackgroundWorkerFunction(), MemoryContextAlloc(), MemoryContextDelete(), MyBackendType, MyBgworkerEntry, PG_exception_stack, pg_usleep(), PostAuthDelay, PostmasterContext, pqsignal, proc_exit(), procsignal_sigusr1_handler(), SIGCHLD, SIGHUP, SIGPIPE, SIGUSR1, SIGUSR2, StatementCancelHandler(), and TopMemoryContext.
void BackgroundWorkerShmemInit | ( | void | ) |
Definition at line 162 of file bgworker.c.
References Assert(), BackgroundWorkerData, BackgroundWorkerList, BackgroundWorkerShmemSize(), BackgroundWorker::bgw_notify_pid, dlist_iter::cur, dlist_container, dlist_foreach, BackgroundWorkerSlot::generation, BackgroundWorkerSlot::in_use, InvalidPid, IsUnderPostmaster, max_worker_processes, BackgroundWorkerArray::parallel_register_count, BackgroundWorkerArray::parallel_terminate_count, BackgroundWorkerSlot::pid, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_worker, ShmemInitStruct(), BackgroundWorkerArray::slot, BackgroundWorkerSlot::terminate, BackgroundWorkerArray::total_slots, and BackgroundWorkerSlot::worker.
Referenced by CreateOrAttachShmemStructs().
Size BackgroundWorkerShmemSize | ( | void | ) |
Definition at line 146 of file bgworker.c.
References add_size(), max_worker_processes, and mul_size().
Referenced by BackgroundWorkerShmemInit(), and CalculateShmemSize().
void BackgroundWorkerStateChange | ( | bool | allow_new_workers | ) |
Definition at line 246 of file bgworker.c.
References ascii_safe_strlcpy(), BackgroundWorkerData, BackgroundWorkerList, BackgroundWorker::bgw_extra, BGW_EXTRALEN, BackgroundWorker::bgw_flags, BackgroundWorker::bgw_function_name, BackgroundWorker::bgw_library_name, BackgroundWorker::bgw_main_arg, BGW_MAXLEN, BackgroundWorker::bgw_name, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, BackgroundWorker::bgw_start_time, BackgroundWorker::bgw_type, BGWORKER_CLASS_PARALLEL, DEBUG1, dlist_push_head(), elog, ereport, errcode(), errmsg(), errmsg_internal(), FindRegisteredWorkerBySlotNumber(), BackgroundWorkerSlot::in_use, kill, LOG, max_worker_processes, MAXPGPATH, MCXT_ALLOC_NO_OOM, MCXT_ALLOC_ZERO, MemoryContextAllocExtended(), BackgroundWorkerArray::parallel_terminate_count, pg_memory_barrier, pg_read_barrier, BackgroundWorkerSlot::pid, PostmasterContext, PostmasterMarkPIDForWorkerNotify(), ReportBackgroundWorkerPID(), RegisteredBgWorker::rw_crashed_at, RegisteredBgWorker::rw_lnode, RegisteredBgWorker::rw_pid, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_terminate, RegisteredBgWorker::rw_worker, SIGUSR1, BackgroundWorkerArray::slot, BackgroundWorkerSlot::terminate, BackgroundWorkerArray::total_slots, and BackgroundWorkerSlot::worker.
Referenced by process_pm_pmsignal().
void BackgroundWorkerStopNotifications | ( | pid_t | pid | ) |
Definition at line 514 of file bgworker.c.
References BackgroundWorkerList, BackgroundWorker::bgw_notify_pid, dlist_iter::cur, dlist_container, dlist_foreach, and RegisteredBgWorker::rw_worker.
Referenced by CleanupBackend().
void ForgetBackgroundWorker | ( | RegisteredBgWorker * | rw | ) |
Definition at line 429 of file bgworker.c.
References Assert(), BackgroundWorkerData, BackgroundWorker::bgw_flags, BackgroundWorker::bgw_name, BGWORKER_CLASS_PARALLEL, DEBUG1, dlist_delete(), ereport, errmsg_internal(), BackgroundWorkerSlot::in_use, max_worker_processes, BackgroundWorkerArray::parallel_terminate_count, pfree(), pg_memory_barrier, RegisteredBgWorker::rw_lnode, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_worker, and BackgroundWorkerArray::slot.
Referenced by DetermineSleepTime(), ForgetUnstartedBackgroundWorkers(), maybe_start_bgworkers(), ReportBackgroundWorkerExit(), and ResetBackgroundWorkerCrashTimes().
void ForgetUnstartedBackgroundWorkers | ( | void | ) |
Definition at line 541 of file bgworker.c.
References Assert(), BackgroundWorkerData, BackgroundWorkerList, BackgroundWorker::bgw_notify_pid, dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, ForgetBackgroundWorker(), InvalidPid, kill, max_worker_processes, BackgroundWorkerSlot::pid, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_worker, SIGUSR1, and BackgroundWorkerArray::slot.
Referenced by PostmasterStateMachine().
void ReportBackgroundWorkerExit | ( | RegisteredBgWorker * | rw | ) |
Definition at line 483 of file bgworker.c.
References Assert(), BackgroundWorkerData, BGW_NEVER_RESTART, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, ForgetBackgroundWorker(), kill, max_worker_processes, BackgroundWorkerSlot::pid, RegisteredBgWorker::rw_pid, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_terminate, RegisteredBgWorker::rw_worker, SIGUSR1, and BackgroundWorkerArray::slot.
Referenced by CleanupBackend().
void ReportBackgroundWorkerPID | ( | RegisteredBgWorker * | rw | ) |
Definition at line 461 of file bgworker.c.
References Assert(), BackgroundWorkerData, BackgroundWorker::bgw_notify_pid, kill, max_worker_processes, BackgroundWorkerSlot::pid, RegisteredBgWorker::rw_pid, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_worker, SIGUSR1, and BackgroundWorkerArray::slot.
Referenced by BackgroundWorkerStateChange(), and StartBackgroundWorker().
void ResetBackgroundWorkerCrashTimes | ( | void | ) |
Definition at line 579 of file bgworker.c.
References Assert(), BackgroundWorkerList, BackgroundWorker::bgw_flags, BGW_NEVER_RESTART, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, BGWORKER_CLASS_PARALLEL, dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, ForgetBackgroundWorker(), RegisteredBgWorker::rw_crashed_at, and RegisteredBgWorker::rw_worker.
Referenced by PostmasterStateMachine().
|
extern |
Definition at line 40 of file bgworker.c.
Referenced by BackgroundWorkerShmemInit(), BackgroundWorkerStateChange(), BackgroundWorkerStopNotifications(), DetermineSleepTime(), FindRegisteredWorkerBySlotNumber(), ForgetUnstartedBackgroundWorkers(), maybe_start_bgworkers(), RegisterBackgroundWorker(), and ResetBackgroundWorkerCrashTimes().