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 (slist_mutable_iter *cur) |
void | ReportBackgroundWorkerPID (RegisteredBgWorker *) |
void | ReportBackgroundWorkerExit (slist_mutable_iter *cur) |
void | BackgroundWorkerStopNotifications (pid_t pid) |
void | ForgetUnstartedBackgroundWorkers (void) |
void | ResetBackgroundWorkerCrashTimes (void) |
void | BackgroundWorkerMain (char *startup_data, size_t startup_data_len) pg_attribute_noreturn() |
Variables | |
PGDLLIMPORT slist_head | BackgroundWorkerList |
#define MAX_PARALLEL_WORKER_LIMIT 1024 |
Definition at line 24 of file bgworker_internals.h.
typedef struct RegisteredBgWorker RegisteredBgWorker |
void BackgroundWorkerMain | ( | char * | startup_data, |
size_t | startup_data_len | ||
) |
Definition at line 723 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(), 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(), SetProcessingMode, SIG_DFL, SIG_IGN, 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, slist_iter::cur, 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(), slist_container, slist_foreach, 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, mul_size(), and 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, 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_backend, RegisteredBgWorker::rw_child_slot, RegisteredBgWorker::rw_crashed_at, RegisteredBgWorker::rw_lnode, RegisteredBgWorker::rw_pid, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_terminate, RegisteredBgWorker::rw_worker, SIGUSR1, slist_push_head(), BackgroundWorkerArray::slot, BackgroundWorkerSlot::terminate, BackgroundWorkerArray::total_slots, and BackgroundWorkerSlot::worker.
Referenced by process_pm_pmsignal().
void BackgroundWorkerStopNotifications | ( | pid_t | pid | ) |
Definition at line 520 of file bgworker.c.
References BackgroundWorkerList, BackgroundWorker::bgw_notify_pid, slist_iter::cur, RegisteredBgWorker::rw_worker, slist_container, and slist_foreach.
Referenced by CleanupBackend(), and CleanupBackgroundWorker().
void ForgetBackgroundWorker | ( | slist_mutable_iter * | cur | ) |
Definition at line 432 of file bgworker.c.
References Assert, BackgroundWorkerData, BackgroundWorker::bgw_flags, BackgroundWorker::bgw_name, BGWORKER_CLASS_PARALLEL, cur, DEBUG1, ereport, errmsg_internal(), BackgroundWorkerSlot::in_use, max_worker_processes, BackgroundWorkerArray::parallel_terminate_count, pfree(), pg_memory_barrier, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_worker, slist_container, slist_delete_current(), and BackgroundWorkerArray::slot.
Referenced by DetermineSleepTime(), ForgetUnstartedBackgroundWorkers(), maybe_start_bgworkers(), ReportBackgroundWorkerExit(), and ResetBackgroundWorkerCrashTimes().
void ForgetUnstartedBackgroundWorkers | ( | void | ) |
Definition at line 547 of file bgworker.c.
References Assert, BackgroundWorkerData, BackgroundWorkerList, BackgroundWorker::bgw_notify_pid, slist_mutable_iter::cur, ForgetBackgroundWorker(), InvalidPid, kill, max_worker_processes, BackgroundWorkerSlot::pid, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_worker, SIGUSR1, slist_container, slist_foreach_modify, and BackgroundWorkerArray::slot.
Referenced by PostmasterStateMachine().
void ReportBackgroundWorkerExit | ( | slist_mutable_iter * | cur | ) |
Definition at line 486 of file bgworker.c.
References Assert, BackgroundWorkerData, BGW_NEVER_RESTART, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, cur, ForgetBackgroundWorker(), kill, max_worker_processes, BackgroundWorkerSlot::pid, RegisteredBgWorker::rw_pid, RegisteredBgWorker::rw_shmem_slot, RegisteredBgWorker::rw_terminate, RegisteredBgWorker::rw_worker, SIGUSR1, slist_container, and BackgroundWorkerArray::slot.
Referenced by CleanupBackgroundWorker().
void ReportBackgroundWorkerPID | ( | RegisteredBgWorker * | rw | ) |
Definition at line 467 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 do_start_bgworker().
void ResetBackgroundWorkerCrashTimes | ( | void | ) |
Definition at line 585 of file bgworker.c.
References Assert, BackgroundWorkerList, BackgroundWorker::bgw_flags, BGW_NEVER_RESTART, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, BGWORKER_CLASS_PARALLEL, slist_mutable_iter::cur, ForgetBackgroundWorker(), RegisteredBgWorker::rw_crashed_at, RegisteredBgWorker::rw_worker, slist_container, and slist_foreach_modify.
Referenced by PostmasterStateMachine().
|
extern |
Definition at line 40 of file bgworker.c.
Referenced by BackgroundWorkerShmemInit(), BackgroundWorkerStateChange(), BackgroundWorkerStopNotifications(), CleanupBackgroundWorker(), DetermineSleepTime(), FindRegisteredWorkerBySlotNumber(), ForgetUnstartedBackgroundWorkers(), HandleChildCrash(), maybe_start_bgworkers(), RegisterBackgroundWorker(), and ResetBackgroundWorkerCrashTimes().