PostgreSQL Source Code git master
|
#include "postgres.h"
#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <sys/wait.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <sys/param.h>
#include <netdb.h>
#include <limits.h>
#include "access/xlog.h"
#include "access/xlogrecovery.h"
#include "common/file_perm.h"
#include "common/pg_prng.h"
#include "lib/ilist.h"
#include "libpq/libpq.h"
#include "libpq/pqsignal.h"
#include "pg_getopt.h"
#include "pgstat.h"
#include "port/pg_bswap.h"
#include "postmaster/autovacuum.h"
#include "postmaster/bgworker_internals.h"
#include "postmaster/pgarch.h"
#include "postmaster/postmaster.h"
#include "postmaster/syslogger.h"
#include "postmaster/walsummarizer.h"
#include "replication/logicallauncher.h"
#include "replication/slotsync.h"
#include "replication/walsender.h"
#include "storage/aio_subsys.h"
#include "storage/fd.h"
#include "storage/io_worker.h"
#include "storage/ipc.h"
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "tcop/backend_startup.h"
#include "tcop/tcopprot.h"
#include "utils/datetime.h"
#include "utils/memutils.h"
#include "utils/pidfile.h"
#include "utils/timestamp.h"
#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
struct | BackendTypeMask |
Macros | |
#define | btmask_add(mask, ...) |
#define | btmask_all_except(...) |
#define | MAXLISTEN 64 |
#define | NoShutdown 0 |
#define | SmartShutdown 1 |
#define | FastShutdown 2 |
#define | ImmediateShutdown 3 |
#define | SIGKILL_CHILDREN_AFTER_SECS 5 |
#define | EXIT_STATUS_0(st) ((st) == 0) |
#define | EXIT_STATUS_1(st) (WIFEXITED(st) && WEXITSTATUS(st) == 1) |
#define | EXIT_STATUS_3(st) (WIFEXITED(st) && WEXITSTATUS(st) == 3) |
#define | PM_TOSTR_CASE(sym) case sym: return #sym |
#define | PM_TOSTR_CASE(sym) case sym: return #sym |
#define | OPTS_FILE "postmaster.opts" |
#define | MAX_BGWORKERS_TO_LAUNCH 100 |
Enumerations | |
enum | StartupStatusEnum { STARTUP_NOT_RUNNING , STARTUP_RUNNING , STARTUP_SIGNALED , STARTUP_CRASHED } |
enum | PMState { PM_INIT , PM_STARTUP , PM_RECOVERY , PM_HOT_STANDBY , PM_RUN , PM_STOP_BACKENDS , PM_WAIT_BACKENDS , PM_WAIT_XLOG_SHUTDOWN , PM_WAIT_XLOG_ARCHIVAL , PM_WAIT_IO_WORKERS , PM_WAIT_CHECKPOINTER , PM_WAIT_DEAD_END , PM_NO_CHILDREN } |
#define btmask_add | ( | mask, | |
... | |||
) |
Definition at line 163 of file postmaster.c.
#define btmask_all_except | ( | ... | ) |
Definition at line 186 of file postmaster.c.
#define EXIT_STATUS_0 | ( | st | ) | ((st) == 0) |
Definition at line 473 of file postmaster.c.
#define EXIT_STATUS_1 | ( | st | ) | (WIFEXITED(st) && WEXITSTATUS(st) == 1) |
Definition at line 474 of file postmaster.c.
#define EXIT_STATUS_3 | ( | st | ) | (WIFEXITED(st) && WEXITSTATUS(st) == 3) |
Definition at line 475 of file postmaster.c.
#define FastShutdown 2 |
Definition at line 284 of file postmaster.c.
#define ImmediateShutdown 3 |
Definition at line 285 of file postmaster.c.
#define MAX_BGWORKERS_TO_LAUNCH 100 |
#define MAXLISTEN 64 |
Definition at line 232 of file postmaster.c.
#define NoShutdown 0 |
Definition at line 282 of file postmaster.c.
#define OPTS_FILE "postmaster.opts" |
#define PM_TOSTR_CASE | ( | sym | ) | case sym: return #sym |
#define PM_TOSTR_CASE | ( | sym | ) | case sym: return #sym |
#define SIGKILL_CHILDREN_AFTER_SECS 5 |
Definition at line 367 of file postmaster.c.
#define SmartShutdown 1 |
Definition at line 283 of file postmaster.c.
enum PMState |
Definition at line 333 of file postmaster.c.
enum StartupStatusEnum |
Enumerator | |
---|---|
STARTUP_NOT_RUNNING | |
STARTUP_RUNNING | |
STARTUP_SIGNALED | |
STARTUP_CRASHED |
Definition at line 271 of file postmaster.c.
|
static |
Definition at line 3529 of file postmaster.c.
References AllocDeadEndChild(), AssignPostmasterChildSlot(), B_BACKEND, PMChild::bgworker_notify, PMChild::bkend_type, CAC_OK, CAC_TOOMANY, canAcceptConnections(), BackendStartupData::canAcceptConnections, PMChild::child_slot, DEBUG2, ereport, errcode(), errmsg(), errmsg_internal(), GetBackendTypeDesc(), GetCurrentTimestamp(), LOG, PMChild::pid, postmaster_child_launch(), ReleasePostmasterChildSlot(), report_fork_failure_to_client(), PMChild::rw, ClientSocket::sock, BackendStartupData::socket_created, STATUS_ERROR, and STATUS_OK.
Referenced by ServerLoop().
|
static |
Definition at line 4170 of file postmaster.c.
References BgWorkerStart_ConsistentState, BgWorkerStart_PostmasterStart, BgWorkerStart_RecoveryFinished, PM_HOT_STANDBY, PM_INIT, PM_NO_CHILDREN, PM_RECOVERY, PM_RUN, PM_STARTUP, PM_STOP_BACKENDS, PM_WAIT_BACKENDS, PM_WAIT_CHECKPOINTER, PM_WAIT_DEAD_END, PM_WAIT_IO_WORKERS, PM_WAIT_XLOG_ARCHIVAL, PM_WAIT_XLOG_SHUTDOWN, pmState, and start_time.
Referenced by maybe_start_bgworkers().
|
inlinestatic |
Definition at line 148 of file postmaster.c.
References BackendTypeMask::mask.
Referenced by PostmasterStateMachine(), and process_pm_pmsignal().
|
inlinestatic |
|
inlinestatic |
Definition at line 177 of file postmaster.c.
References btmask_del(), BTYPE_MASK_ALL, and i.
|
inlinestatic |
Definition at line 193 of file postmaster.c.
References BackendTypeMask::mask.
Referenced by CountChildren(), and SignalChildren().
|
inlinestatic |
Definition at line 170 of file postmaster.c.
References BackendTypeMask::mask.
Referenced by btmask_all_except_n().
|
static |
Definition at line 1810 of file postmaster.c.
References Assert(), B_AUTOVAC_WORKER, B_BACKEND, CAC_NOTCONSISTENT, CAC_OK, CAC_RECOVERY, CAC_SHUTDOWN, CAC_STARTUP, connsAllowed, FatalError, NoShutdown, PM_HOT_STANDBY, PM_RECOVERY, PM_RUN, PM_STARTUP, pmState, and Shutdown.
Referenced by BackendStartup(), and StartAutovacuumWorker().
|
static |
Definition at line 1514 of file postmaster.c.
References AllocateFile(), DataDir, ExitPostmaster(), FreeFile(), MAXPGPATH, PG_BINARY_R, progname, snprintf, and write_stderr.
Referenced by PostmasterMain().
|
static |
Definition at line 2565 of file postmaster.c.
References _, B_BG_WORKER, BackgroundWorkerStopNotifications(), BackgroundWorker::bgw_type, PMChild::bgworker_notify, PMChild::bkend_type, DEBUG1, DEBUG2, EXIT_STATUS_0, EXIT_STATUS_1, GetBackendTypeDesc(), GetCurrentTimestamp(), HandleChildCrash(), HaveCrashedWorker, LOG, LogChildExit(), MAXPGPATH, PMChild::pid, ReleasePostmasterChildSlot(), ReportBackgroundWorkerExit(), PMChild::rw, RegisteredBgWorker::rw_crashed_at, RegisteredBgWorker::rw_pid, RegisteredBgWorker::rw_terminate, RegisteredBgWorker::rw_worker, and snprintf.
Referenced by process_pm_child_exit().
void ClosePostmasterPorts | ( | bool | am_syslogger | ) |
Definition at line 1855 of file postmaster.c.
References close, closesocket, elog, ereport, errcode_for_file_access(), errmsg_internal(), FATAL, FreeWaitEventSetAfterFork(), i, ListenSockets, LOG, NumListenSockets, pfree(), pm_wait_set, postmaster_alive_fds, POSTMASTER_FD_OWN, ReleaseExternalFD(), and syslogPipe.
Referenced by postmaster_child_launch().
|
static |
Definition at line 1414 of file postmaster.c.
References closesocket, elog, i, ListenSockets, LOG, NumListenSockets, and RemoveSocketFiles().
Referenced by PostmasterMain().
|
static |
Definition at line 1628 of file postmaster.c.
References AddWaitEventToSet(), CreateWaitEventSet(), FreeWaitEventSet(), i, ListenSockets, MyLatch, NumListenSockets, PGINVALID_SOCKET, pm_wait_set, WL_LATCH_SET, and WL_SOCKET_ACCEPT.
Referenced by HandleFatalError(), PostmasterStateMachine(), process_pm_child_exit(), and ServerLoop().
|
static |
Definition at line 3902 of file postmaster.c.
References ActiveChildList, B_BACKEND, B_WAL_SENDER, PMChild::bkend_type, btmask_contains(), PMChild::child_slot, dlist_iter::cur, DEBUG4, dlist_container, dlist_foreach, ereport, errmsg_internal(), GetBackendTypeDesc(), IsPostmasterChildWalSender(), and PMChild::pid.
Referenced by PostmasterStateMachine().
|
static |
Definition at line 4067 of file postmaster.c.
References ereport, errcode_for_file_access(), errmsg(), fprintf, i, LOG, and OPTS_FILE.
Referenced by PostmasterMain().
|
static |
Definition at line 1543 of file postmaster.c.
References AbortStartTime, BackgroundWorkerList, BGW_NEVER_RESTART, BackgroundWorker::bgw_restart_time, dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, ForgetBackgroundWorker(), GetCurrentTimestamp(), HaveCrashedWorker, Max, Min, NoShutdown, RegisteredBgWorker::rw_crashed_at, RegisteredBgWorker::rw_terminate, RegisteredBgWorker::rw_worker, Shutdown, SIGKILL_CHILDREN_AFTER_SECS, StartWorkerNeeded, TimestampDifferenceMilliseconds(), and TimestampTzPlusMilliseconds.
Referenced by ServerLoop().
|
static |
|
static |
Definition at line 3646 of file postmaster.c.
References ereport, errcode(), errhint(), errmsg(), LOG, and proc_exit().
Referenced by checkControlFile(), PostmasterMain(), PostmasterStateMachine(), process_pm_child_exit(), and StartChildProcess().
|
static |
Definition at line 1460 of file postmaster.c.
References AllocateDir(), argv0, ereport, errcode_for_file_access(), errhint(), errmsg(), ERROR, FATAL, find_my_exec(), find_other_exec(), FreeDir(), get_pkglib_path(), my_exec_path, PG_BACKEND_VERSIONSTR, and pkglib_path.
Referenced by PostmasterMain().
|
static |
Definition at line 2222 of file postmaster.c.
References MyLatch, pending_pm_child_exit, and SetLatch().
Referenced by PostmasterMain().
|
static |
Definition at line 1974 of file postmaster.c.
References MyLatch, pending_pm_pmsignal, and SetLatch().
Referenced by PostmasterMain().
|
static |
Definition at line 1984 of file postmaster.c.
References MyLatch, pending_pm_reload_request, and SetLatch().
Referenced by PostmasterMain().
|
static |
Definition at line 2047 of file postmaster.c.
References MyLatch, pending_pm_fast_shutdown_request, pending_pm_immediate_shutdown_request, pending_pm_shutdown_request, SetLatch(), and SIGQUIT.
Referenced by PostmasterMain().
|
static |
Definition at line 2783 of file postmaster.c.
References ereport, errmsg(), FatalError, HandleFatalError(), ImmediateShutdown, LOG, LogChildExit(), PMQUIT_FOR_CRASH, and Shutdown.
Referenced by CleanupBackend(), and process_pm_child_exit().
|
static |
Definition at line 2694 of file postmaster.c.
References AbortStartTime, Assert(), ConfigurePostmasterWaitSet(), FatalError, ImmediateShutdown, PM_HOT_STANDBY, PM_INIT, PM_NO_CHILDREN, PM_RECOVERY, PM_RUN, PM_STARTUP, PM_STOP_BACKENDS, PM_WAIT_BACKENDS, PM_WAIT_CHECKPOINTER, PM_WAIT_DEAD_END, PM_WAIT_IO_WORKERS, PM_WAIT_XLOG_ARCHIVAL, PM_WAIT_XLOG_SHUTDOWN, pmState, send_abort_for_crash, SetQuitSignalReason(), Shutdown, SIGABRT, SIGQUIT, TerminateChildren(), and UpdatePMState().
Referenced by HandleChildCrash(), PostmasterStateMachine(), and process_pm_pmsignal().
|
static |
Definition at line 4564 of file postmaster.c.
References Assert(), ereport, errcode_for_file_access(), errcode_for_socket_access(), errmsg_internal(), FATAL, MyProcPid, postmaster_alive_fds, POSTMASTER_FD_WATCH, PostmasterPid, and ReserveExternalFD().
Referenced by PostmasterMain().
void InitProcessGlobals | ( | void | ) |
Definition at line 1932 of file postmaster.c.
References GetCurrentTimestamp(), MyProcPid, MyStartTime, MyStartTimestamp, pg_global_prng_state, pg_prng_seed(), pg_prng_strong_seed, pg_prng_uint32(), timestamptz_to_time_t(), and unlikely.
Referenced by InitPostmasterChild(), InitStandaloneProcess(), and PostmasterMain().
|
static |
Definition at line 3278 of file postmaster.c.
References AutoVacLauncherPMChild, AutoVacuumingActive(), B_ARCHIVER, B_AUTOVAC_LAUNCHER, B_BG_WRITER, B_CHECKPOINTER, B_SLOTSYNC_WORKER, B_WAL_RECEIVER, B_WAL_SUMMARIZER, B_WAL_WRITER, BgWriterPMChild, CheckpointerPMChild, HaveCrashedWorker, IsBinaryUpgrade, LOG, Logging_collector, maybe_adjust_io_workers(), maybe_start_bgworkers(), PgArchCanRestart(), PgArchPMChild, PM_HOT_STANDBY, PM_RECOVERY, PM_RUN, PM_STARTUP, pmState, Shutdown, SlotSyncWorkerCanRestart(), SlotSyncWorkerPMChild, SmartShutdown, start_autovac_launcher, StartChildProcess(), StartSysLogger(), StartWorkerNeeded, summarize_wal, sync_replication_slots, SysLoggerPMChild, ValidateSlotSyncParams(), WalReceiverPMChild, WalReceiverRequested, WalSummarizerPMChild, WalWriterPMChild, XLogArchivingActive, and XLogArchivingAlways.
Referenced by ServerLoop().
|
static |
Definition at line 2810 of file postmaster.c.
References ereport, errdetail(), errhint(), errmsg(), EXIT_STATUS_0, pg_strsignal(), pgstat_get_crashed_backend_activity(), WEXITSTATUS, WIFEXITED, WIFSIGNALED, and WTERMSIG.
Referenced by CleanupBackend(), HandleChildCrash(), and process_pm_child_exit().
|
static |
Definition at line 4356 of file postmaster.c.
References Assert(), B_IO_WORKER, elog, ERROR, FatalError, ImmediateShutdown, io_worker_children, io_worker_count, io_workers, kill, MAX_IO_WORKERS, pgaio_workers_enabled(), PM_STOP_BACKENDS, PM_WAIT_IO_WORKERS, pmState, Shutdown, SIGUSR2, and StartChildProcess().
Referenced by LaunchMissingBackgroundProcesses(), PostmasterMain(), PostmasterStateMachine(), and process_pm_child_exit().
|
static |
Definition at line 4331 of file postmaster.c.
References io_worker_children, io_worker_count, MAX_IO_WORKERS, and ReleasePostmasterChildSlot().
Referenced by process_pm_child_exit().
|
static |
Definition at line 4217 of file postmaster.c.
References BackgroundWorkerList, BGW_NEVER_RESTART, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, BackgroundWorker::bgw_start_time, bgworker_should_start_now(), dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, FatalError, ForgetBackgroundWorker(), GetCurrentTimestamp(), HaveCrashedWorker, kill, MAX_BGWORKERS_TO_LAUNCH, now(), RegisteredBgWorker::rw_crashed_at, RegisteredBgWorker::rw_pid, RegisteredBgWorker::rw_terminate, RegisteredBgWorker::rw_worker, SIGUSR1, StartBackgroundWorker(), StartWorkerNeeded, and TimestampDifferenceExceeds().
Referenced by LaunchMissingBackgroundProcesses(), and PostmasterMain().
|
static |
Definition at line 3401 of file postmaster.c.
References Assert(), PM_TOSTR_CASE, SIGABRT, SIGCHLD, SIGHUP, SIGKILL, SIGQUIT, SIGUSR1, and SIGUSR2.
Referenced by signal_child().
|
static |
Definition at line 3232 of file postmaster.c.
References pg_unreachable, PM_HOT_STANDBY, PM_INIT, PM_NO_CHILDREN, PM_RECOVERY, PM_RUN, PM_STARTUP, PM_STOP_BACKENDS, PM_TOSTR_CASE, PM_WAIT_BACKENDS, PM_WAIT_CHECKPOINTER, PM_WAIT_DEAD_END, PM_WAIT_IO_WORKERS, PM_WAIT_XLOG_ARCHIVAL, and PM_WAIT_XLOG_SHUTDOWN.
Referenced by UpdatePMState().
void PostmasterMain | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 492 of file postmaster.c.
References AddToDataDirLockFile(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, appendStringInfo(), appendStringInfoString(), ApplyLauncherRegister(), ARCHIVE_MODE_OFF, Assert(), autovac_init(), B_BG_WRITER, B_CHECKPOINTER, B_STARTUP, BgWriterPMChild, BlockSig, bonjour_name, ChangeToDataDir(), checkControlFile(), checkDataDir(), CheckDateTokenTables(), CheckpointerPMChild, CloseServerPorts(), CreateDataDirLockFile(), CreateOptsFile(), CreateSharedMemoryAndSemaphores(), StringInfoData::data, DEBUG3, DestNone, DISPATCH_POSTMASTER, dummy_handler(), enable_bonjour, EnableSSL, environ, ereport, err(), errcode(), errcode_for_file_access(), errhint(), errmsg(), errmsg_internal(), ERROR, ExitPostmaster(), external_pid_file, FATAL, fprintf, get_stats_option_name(), GetConfigOption(), GetConfigOptionFlags(), GetCurrentTimestamp(), getInstallationPaths(), getopt(), GUC_RUNTIME_COMPUTED, handle_pm_child_exit_signal(), handle_pm_pmsignal_signal(), handle_pm_reload_request_signal(), handle_pm_shutdown_request_signal(), HbaFileName, InitializeFastPathLocks(), InitializeGUCOptions(), InitializeMaxBackends(), InitializeShmemGUCs(), InitializeWaitEventSupport(), InitializeWalConsistencyChecking(), InitPostmasterChildSlots(), InitPostmasterDeathWatchHandle(), InitProcessGlobals(), InitProcessLocalLatch(), initStringInfo(), IsBinaryUpgrade, IsPostmasterEnvironment, lfirst, list_free(), list_free_deep(), ListenAddresses, ListenServerPort(), ListenSockets, load_hba(), load_ident(), LoadedSSL, LocalProcessControlFile(), LOCK_FILE_LINE_LISTEN_ADDR, LOCK_FILE_LINE_PM_STATUS, LOCK_FILE_LINE_SOCKET_DIR, LOG, Log_destination, LOG_DESTINATION_STDERR, Log_destination_string, LOG_METAINFO_DATAFILE, Logging_collector, max_wal_senders, MaxConnections, MAXLISTEN, maybe_adjust_io_workers(), maybe_start_bgworkers(), MemoryContextSwitchTo(), message_level_is_interesting(), my_exec_path, MyProcPid, name, NIL, NumListenSockets, on_proc_exit(), optarg, opterr, optind, palloc(), parse_dispatch_option(), ParseLongOption(), pfree(), pg_hton16, PG_MODE_MASK_OWNER, PG_TEMP_FILES_DIR, PGC_POSTMASTER, PGC_S_ARGV, PGC_S_OVERRIDE, PGC_SUSET, PgStartTime, pgwin32_signal_initialize(), PM_STARTUP, PM_STATUS_STARTING, PostmasterContext, PostmasterPid, PostPortNumber, pqinitmask(), pqsignal, process_shared_preload_libraries(), process_shmem_requests(), progname, pstrdup(), RemoveLogrotateSignalFiles(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePromoteSignalFiles(), ReservedConnections, S_IRGRP, S_IROTH, S_IRUSR, S_IWUSR, secure_initialize(), SelectConfigFiles(), ServerLoop(), set_debug_options(), set_max_safe_fds(), set_plan_disabling_options(), SetConfigOption(), SIGALRM, SIGCHLD, SIGHUP, SIGPIPE, SIGQUIT, SIGUSR1, SIGUSR2, SplitDirectoriesString(), SplitGUCList(), StartChildProcess(), StartSysLogger(), STARTUP_RUNNING, StartupPMChild, StartupStatus, STATUS_OK, success, summarize_wal, SuperuserReservedConnections, TopMemoryContext, UnBlockSig, Unix_socket_directories, unlink_external_pid_file(), UpdatePMState(), userDoption, value, wal_level, WAL_LEVEL_MINIMAL, WARNING, whereToSendOutput, write_stderr, and XLogArchiveMode.
Referenced by main().
bool PostmasterMarkPIDForWorkerNotify | ( | int | pid | ) |
Definition at line 4429 of file postmaster.c.
References ActiveChildList, PMChild::bgworker_notify, dlist_iter::cur, dlist_container, dlist_foreach, and PMChild::pid.
Referenced by BackgroundWorkerStateChange().
|
static |
Definition at line 2876 of file postmaster.c.
References AbortStartTime, Assert(), AutoVacLauncherPMChild, B_ARCHIVER, B_AUTOVAC_LAUNCHER, B_AUTOVAC_WORKER, B_BACKEND, B_BG_WORKER, B_BG_WRITER, B_CHECKPOINTER, B_DEAD_END_BACKEND, B_INVALID, B_IO_WORKER, B_LOGGER, B_SLOTSYNC_WORKER, B_STANDALONE_BACKEND, B_STARTUP, B_WAL_RECEIVER, B_WAL_SENDER, B_WAL_SUMMARIZER, B_WAL_WRITER, BgWriterPMChild, btmask(), btmask_add, btmask_all_except, BTYPE_MASK_ALL, BTYPE_MASK_NONE, CheckpointerPMChild, ConfigurePostmasterWaitSet(), connsAllowed, CountChildren(), CreateSharedMemoryAndSemaphores(), ereport, errmsg(), ExitPostmaster(), FatalError, ForgetUnstartedBackgroundWorkers(), HandleFatalError(), ImmediateShutdown, io_worker_count, LocalProcessControlFile(), LOG, BackendTypeMask::mask, maybe_adjust_io_workers(), NoShutdown, PM_HOT_STANDBY, PM_NO_CHILDREN, PM_RUN, PM_STARTUP, PM_STOP_BACKENDS, PM_WAIT_BACKENDS, PM_WAIT_CHECKPOINTER, PM_WAIT_DEAD_END, PM_WAIT_IO_WORKERS, PM_WAIT_XLOG_ARCHIVAL, PM_WAIT_XLOG_SHUTDOWN, PMQUIT_FOR_CRASH, pmState, remove_temp_files_after_crash, RemovePgTempFiles(), ResetBackgroundWorkerCrashTimes(), restart_after_crash, shmem_exit(), Shutdown, signal_child(), SignalChildren(), SIGQUIT, SIGUSR2, SlotSyncWorkerPMChild, StartChildProcess(), STARTUP_CRASHED, STARTUP_RUNNING, StartupPMChild, StartupStatus, UpdatePMState(), WalReceiverPMChild, WalSummarizerPMChild, and WalWriterPMChild.
Referenced by process_pm_child_exit(), process_pm_pmsignal(), and process_pm_shutdown_request().
|
static |
Definition at line 2232 of file postmaster.c.
References _, AbortStartTime, AddToDataDirLockFile(), AutoVacLauncherPMChild, B_LOGGER, BgWriterPMChild, btmask_all_except, CheckpointerPMChild, CleanupBackend(), ConfigurePostmasterWaitSet(), connsAllowed, DEBUG4, ereport, errmsg(), errmsg_internal(), EXIT_STATUS_0, EXIT_STATUS_1, EXIT_STATUS_3, ExitPostmaster(), FatalError, FindPostmasterChildByPid(), HandleChildCrash(), LOCK_FILE_LINE_PM_STATUS, LOG, LogChildExit(), Logging_collector, Max, maybe_adjust_io_workers(), maybe_reap_io_worker(), NoShutdown, pending_pm_child_exit, PgArchPMChild, PMChild::pid, PM_RUN, PM_STARTUP, PM_STATUS_READY, PM_WAIT_BACKENDS, PM_WAIT_CHECKPOINTER, PM_WAIT_DEAD_END, pmState, PostmasterStateMachine(), ReachedNormalRunning, ReleasePostmasterChildSlot(), Shutdown, SignalChildren(), SlotSyncWorkerPMChild, SmartShutdown, StartSysLogger(), STARTUP_CRASHED, STARTUP_NOT_RUNNING, STARTUP_SIGNALED, StartupPMChild, StartupStatus, StartWorkerNeeded, SysLoggerPMChild, TerminateChildren(), UpdatePMState(), WalReceiverPMChild, WalSummarizerPMChild, and WalWriterPMChild.
Referenced by ServerLoop().
|
static |
Definition at line 3681 of file postmaster.c.
References AbortStartTime, AddToDataDirLockFile(), Assert(), B_ARCHIVER, B_WAL_SENDER, BackgroundWorkerStateChange(), btmask(), CheckLogrotateSignal(), CheckPostmasterSignal(), CheckPromoteSignal(), connsAllowed, DEBUG2, EnableHotStandby, ereport, errmsg(), errmsg_internal(), FatalError, HandleFatalError(), ImmediateShutdown, LOCK_FILE_LINE_PM_STATUS, LOG, NoShutdown, pending_pm_pmsignal, PgArchPMChild, PM_HOT_STANDBY, PM_RECOVERY, PM_STARTUP, PM_STATUS_READY, PM_STATUS_STANDBY, PM_STOP_BACKENDS, PM_WAIT_XLOG_ARCHIVAL, PM_WAIT_XLOG_SHUTDOWN, PMQUIT_FOR_CRASH, PMSIGNAL_ADVANCE_STATE_MACHINE, PMSIGNAL_BACKGROUND_WORKER_CHANGE, PMSIGNAL_BEGIN_HOT_STANDBY, PMSIGNAL_RECOVERY_STARTED, PMSIGNAL_ROTATE_LOGFILE, PMSIGNAL_START_AUTOVAC_LAUNCHER, PMSIGNAL_START_AUTOVAC_WORKER, PMSIGNAL_START_WALRECEIVER, PMSIGNAL_XLOG_IS_SHUTDOWN, pmState, PostmasterStateMachine(), RemoveLogrotateSignalFiles(), Shutdown, signal_child(), SignalChildren(), SIGUSR1, SIGUSR2, SmartShutdown, start_autovac_launcher, StartAutovacuumWorker(), StartChildProcess(), StartupPMChild, StartWorkerNeeded, SysLoggerPMChild, UpdatePMState(), WalReceiverRequested, and XLogArchivingAlways.
Referenced by ServerLoop().
|
static |
Definition at line 1994 of file postmaster.c.
References B_DEAD_END_BACKEND, btmask_all_except, DEBUG2, EnableSSL, ereport, errmsg(), errmsg_internal(), HbaFileName, IdentFileName, load_hba(), load_ident(), LoadedSSL, LOG, pending_pm_reload_request, PGC_SIGHUP, ProcessConfigFile(), secure_destroy(), secure_initialize(), Shutdown, SIGHUP, SignalChildren(), and SmartShutdown.
Referenced by ServerLoop().
|
static |
Definition at line 2071 of file postmaster.c.
References AbortStartTime, AddToDataDirLockFile(), connsAllowed, DEBUG2, ereport, errmsg(), errmsg_internal(), FastShutdown, ImmediateShutdown, LOCK_FILE_LINE_PM_STATUS, LOG, mode, pending_pm_fast_shutdown_request, pending_pm_immediate_shutdown_request, pending_pm_shutdown_request, PM_HOT_STANDBY, PM_RECOVERY, PM_RUN, PM_STARTUP, PM_STATUS_STOPPING, PM_STOP_BACKENDS, PM_WAIT_BACKENDS, PMQUIT_FOR_STOP, pmState, PostmasterStateMachine(), SetQuitSignalReason(), Shutdown, SIGQUIT, SmartShutdown, TerminateChildren(), and UpdatePMState().
Referenced by ServerLoop().
|
static |
Definition at line 3619 of file postmaster.c.
References _, EINTR, pg_set_noblock(), send, snprintf, ClientSocket::sock, and strerror.
Referenced by BackendStartup().
|
static |
Definition at line 1651 of file postmaster.c.
References AbortStartTime, AcceptConnection(), Assert(), AutoVacLauncherPMChild, avlauncher_needs_signal, BackendStartup(), closesocket, ConfigurePostmasterWaitSet(), DetermineSleepTime(), elog, ereport, errmsg(), FatalError, fd(), i, ImmediateShutdown, kill, LaunchMissingBackgroundProcesses(), lengthof, LOG, MAXLISTEN, MyLatch, MyProcPid, now(), pending_pm_child_exit, pending_pm_pmsignal, pending_pm_reload_request, pending_pm_shutdown_request, PGINVALID_SOCKET, pm_wait_set, process_pm_child_exit(), process_pm_pmsignal(), process_pm_reload_request(), process_pm_shutdown_request(), RecheckDataDirLockFile(), ResetLatch(), SECS_PER_MINUTE, send_abort_for_kill, Shutdown, SIGABRT, SIGKILL, SIGKILL_CHILDREN_AFTER_SECS, signal_child(), SIGQUIT, SIGUSR2, ClientSocket::sock, STATUS_OK, TerminateChildren(), TouchSocketFiles(), TouchSocketLockFiles(), WaitEventSetWait(), WL_LATCH_SET, and WL_SOCKET_ACCEPT.
Referenced by PostmasterMain().
|
static |
Definition at line 3442 of file postmaster.c.
References PMChild::bkend_type, DEBUG3, elog, ereport, errmsg_internal(), GetBackendTypeDesc(), kill, PMChild::pid, pm_signame(), SIGABRT, SIGKILL, and SIGQUIT.
Referenced by PostmasterStateMachine(), process_pm_pmsignal(), ServerLoop(), and SignalChildren().
|
static |
Definition at line 3475 of file postmaster.c.
References ActiveChildList, B_BACKEND, B_WAL_SENDER, PMChild::bkend_type, btmask_contains(), PMChild::child_slot, dlist_iter::cur, dlist_container, dlist_foreach, IsPostmasterChildWalSender(), and signal_child().
Referenced by PostmasterStateMachine(), process_pm_child_exit(), process_pm_pmsignal(), process_pm_reload_request(), and TerminateChildren().
|
static |
Definition at line 4017 of file postmaster.c.
References AutoVacLauncherPMChild, AutoVacWorkerFailed(), avlauncher_needs_signal, B_AUTOVAC_WORKER, PMChild::bgworker_notify, CAC_OK, canAcceptConnections(), PMChild::rw, and StartChildProcess().
Referenced by process_pm_pmsignal().
|
static |
Definition at line 4109 of file postmaster.c.
References Assert(), AssignPostmasterChildSlot(), B_BG_WORKER, BackgroundWorker::bgw_name, PMChild::bgworker_notify, PMChild::bkend_type, PMChild::child_slot, DEBUG1, ereport, errcode(), errmsg(), errmsg_internal(), GetCurrentTimestamp(), LOG, PMChild::pid, postmaster_child_launch(), ReleasePostmasterChildSlot(), ReportBackgroundWorkerPID(), PMChild::rw, RegisteredBgWorker::rw_crashed_at, RegisteredBgWorker::rw_pid, and RegisteredBgWorker::rw_worker.
Referenced by maybe_start_bgworkers().
|
static |
Definition at line 3946 of file postmaster.c.
References AssignPostmasterChildSlot(), B_AUTOVAC_WORKER, B_STARTUP, PMChild::child_slot, elog, ereport, errcode(), errmsg(), ExitPostmaster(), LOG, PMChild::pid, postmaster_child_launch(), PostmasterChildName(), ReleasePostmasterChildSlot(), and type.
Referenced by LaunchMissingBackgroundProcesses(), maybe_adjust_io_workers(), PostmasterMain(), PostmasterStateMachine(), process_pm_pmsignal(), and StartAutovacuumWorker().
|
static |
Definition at line 3992 of file postmaster.c.
References Assert(), AssignPostmasterChildSlot(), B_LOGGER, PMChild::child_slot, elog, PANIC, PMChild::pid, ReleasePostmasterChildSlot(), SysLogger_Start(), and SysLoggerPMChild.
Referenced by LaunchMissingBackgroundProcesses(), PostmasterMain(), and process_pm_child_exit().
StaticAssertDecl | ( | ) |
|
static |
Definition at line 3510 of file postmaster.c.
References B_LOGGER, btmask_all_except, SIGABRT, SIGKILL, SignalChildren(), SIGQUIT, STARTUP_SIGNALED, StartupPMChild, and StartupStatus.
Referenced by HandleFatalError(), process_pm_child_exit(), process_pm_shutdown_request(), and ServerLoop().
|
static |
Definition at line 1448 of file postmaster.c.
References external_pid_file.
Referenced by PostmasterMain().
|
static |
Definition at line 3262 of file postmaster.c.
References DEBUG1, elog, pmState, and pmstate_name().
Referenced by HandleFatalError(), PostmasterMain(), PostmasterStateMachine(), process_pm_child_exit(), process_pm_pmsignal(), and process_pm_shutdown_request().
|
static |
Definition at line 364 of file postmaster.c.
Referenced by DetermineSleepTime(), HandleFatalError(), PostmasterStateMachine(), process_pm_child_exit(), process_pm_pmsignal(), process_pm_shutdown_request(), and ServerLoop().
int AuthenticationTimeout = 60 |
Definition at line 240 of file postmaster.c.
Referenced by BackendInitialize(), and PerformAuthentication().
|
static |
Definition at line 265 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), PostmasterStateMachine(), process_pm_child_exit(), ServerLoop(), and StartAutovacuumWorker().
|
static |
Definition at line 380 of file postmaster.c.
Referenced by ServerLoop(), and StartAutovacuumWorker().
|
static |
Definition at line 260 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), PostmasterMain(), PostmasterStateMachine(), and process_pm_child_exit().
char* bonjour_name |
Definition at line 245 of file postmaster.c.
Referenced by PostmasterMain().
|
static |
Definition at line 144 of file postmaster.c.
Referenced by btmask_all_except_n(), and PostmasterStateMachine().
|
static |
Definition at line 145 of file postmaster.c.
Referenced by PostmasterStateMachine().
|
static |
Definition at line 261 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), PostmasterMain(), PostmasterStateMachine(), and process_pm_child_exit().
bool ClientAuthInProgress = false |
Definition at line 371 of file postmaster.c.
Referenced by BackendInitialize(), PerformAuthentication(), ProcessInterrupts(), quickdie(), should_output_to_client(), and StatementTimeoutHandler().
|
static |
Definition at line 360 of file postmaster.c.
Referenced by canAcceptConnections(), PostmasterStateMachine(), process_pm_child_exit(), process_pm_pmsignal(), and process_pm_shutdown_request().
bool enable_bonjour = false |
Definition at line 244 of file postmaster.c.
Referenced by PostmasterMain().
bool EnableSSL = false |
Definition at line 237 of file postmaster.c.
Referenced by BackendMain(), parse_hba_line(), PostmasterMain(), and process_pm_reload_request().
|
static |
Definition at line 289 of file postmaster.c.
Referenced by canAcceptConnections(), HandleChildCrash(), HandleFatalError(), maybe_adjust_io_workers(), maybe_start_bgworkers(), PostmasterStateMachine(), process_pm_child_exit(), process_pm_pmsignal(), and ServerLoop().
|
static |
Definition at line 387 of file postmaster.c.
Referenced by CleanupBackend(), DetermineSleepTime(), LaunchMissingBackgroundProcesses(), and maybe_start_bgworkers().
|
static |
Definition at line 411 of file postmaster.c.
Referenced by maybe_adjust_io_workers(), and maybe_reap_io_worker().
|
static |
Definition at line 410 of file postmaster.c.
Referenced by maybe_adjust_io_workers(), maybe_reap_io_worker(), and PostmasterStateMachine().
char* ListenAddresses |
Definition at line 208 of file postmaster.c.
Referenced by PostmasterMain().
|
static |
Definition at line 234 of file postmaster.c.
Referenced by ClosePostmasterPorts(), CloseServerPorts(), ConfigurePostmasterWaitSet(), ListenServerPort(), and PostmasterMain().
bool log_hostname |
Definition at line 242 of file postmaster.c.
Referenced by BackendInitialize().
BackgroundWorker* MyBgworkerEntry = NULL |
Definition at line 199 of file postmaster.c.
Referenced by BackgroundWorkerInitializeConnection(), BackgroundWorkerInitializeConnectionByOid(), BackgroundWorkerMain(), bgworker_die(), get_backend_type_for_log(), ParallelApplyWorkerMain(), ParallelWorkerMain(), ProcessInterrupts(), test_shm_mq_main(), and worker_spi_main().
|
static |
Definition at line 233 of file postmaster.c.
Referenced by ClosePostmasterPorts(), CloseServerPorts(), ConfigurePostmasterWaitSet(), ListenServerPort(), and PostmasterMain().
|
static |
Definition at line 391 of file postmaster.c.
Referenced by handle_pm_child_exit_signal(), process_pm_child_exit(), and ServerLoop().
|
static |
Definition at line 394 of file postmaster.c.
Referenced by handle_pm_shutdown_request_signal(), and process_pm_shutdown_request().
|
static |
Definition at line 395 of file postmaster.c.
Referenced by handle_pm_shutdown_request_signal(), and process_pm_shutdown_request().
|
static |
Definition at line 390 of file postmaster.c.
Referenced by handle_pm_pmsignal_signal(), process_pm_pmsignal(), and ServerLoop().
|
static |
Definition at line 392 of file postmaster.c.
Referenced by handle_pm_reload_request_signal(), process_pm_reload_request(), and ServerLoop().
|
static |
Definition at line 393 of file postmaster.c.
Referenced by handle_pm_shutdown_request_signal(), process_pm_shutdown_request(), and ServerLoop().
|
static |
Definition at line 266 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), process_pm_child_exit(), and process_pm_pmsignal().
|
static |
Definition at line 398 of file postmaster.c.
Referenced by ClosePostmasterPorts(), ConfigurePostmasterWaitSet(), and ServerLoop().
Definition at line 352 of file postmaster.c.
Referenced by bgworker_should_start_now(), canAcceptConnections(), HandleFatalError(), LaunchMissingBackgroundProcesses(), maybe_adjust_io_workers(), PostmasterStateMachine(), process_pm_child_exit(), process_pm_pmsignal(), process_pm_shutdown_request(), and UpdatePMState().
int postmaster_alive_fds[2] = {-1, -1} |
Definition at line 482 of file postmaster.c.
Referenced by AddWaitEventToSet(), ClosePostmasterPorts(), InitPostmasterChild(), InitPostmasterDeathWatchHandle(), and PostmasterIsAliveInternal().
int PostPortNumber = DEF_PGPORT |
Definition at line 202 of file postmaster.c.
Referenced by CreateLockFile(), and PostmasterMain().
int PreAuthDelay = 0 |
Definition at line 239 of file postmaster.c.
Referenced by BackendInitialize().
|
static |
Definition at line 369 of file postmaster.c.
Referenced by process_pm_child_exit().
bool redirection_done = false |
Definition at line 374 of file postmaster.c.
Referenced by send_message_to_server_log(), SysLogger_Start(), SysLoggerMain(), and write_console().
bool remove_temp_files_after_crash = true |
Definition at line 247 of file postmaster.c.
Referenced by PostmasterStateMachine().
int ReservedConnections |
Definition at line 229 of file postmaster.c.
Referenced by InitPostgres(), and PostmasterMain().
bool restart_after_crash = true |
Definition at line 246 of file postmaster.c.
Referenced by PostmasterStateMachine().
bool send_abort_for_crash = false |
Definition at line 255 of file postmaster.c.
Referenced by HandleFatalError().
bool send_abort_for_kill = false |
Definition at line 256 of file postmaster.c.
Referenced by ServerLoop().
|
static |
Definition at line 287 of file postmaster.c.
Referenced by canAcceptConnections(), DetermineSleepTime(), HandleChildCrash(), HandleFatalError(), LaunchMissingBackgroundProcesses(), maybe_adjust_io_workers(), PostmasterStateMachine(), process_pm_child_exit(), process_pm_pmsignal(), process_pm_reload_request(), process_pm_shutdown_request(), and ServerLoop().
|
static |
Definition at line 268 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), PostmasterStateMachine(), and process_pm_child_exit().
|
static |
Definition at line 377 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), and process_pm_pmsignal().
|
static |
Definition at line 259 of file postmaster.c.
Referenced by PostmasterMain(), PostmasterStateMachine(), process_pm_child_exit(), process_pm_pmsignal(), and TerminateChildren().
|
static |
Definition at line 279 of file postmaster.c.
Referenced by PostmasterMain(), PostmasterStateMachine(), process_pm_child_exit(), and TerminateChildren().
|
static |
Definition at line 386 of file postmaster.c.
Referenced by DetermineSleepTime(), LaunchMissingBackgroundProcesses(), maybe_start_bgworkers(), process_pm_child_exit(), and process_pm_pmsignal().
int SuperuserReservedConnections |
Definition at line 228 of file postmaster.c.
Referenced by InitPostgres(), and PostmasterMain().
|
static |
Definition at line 267 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), process_pm_child_exit(), process_pm_pmsignal(), and StartSysLogger().
char* Unix_socket_directories |
Definition at line 205 of file postmaster.c.
Referenced by PostmasterMain().
|
static |
Definition at line 263 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), PostmasterStateMachine(), and process_pm_child_exit().
|
static |
Definition at line 383 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), and process_pm_pmsignal().
|
static |
Definition at line 264 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), PostmasterStateMachine(), and process_pm_child_exit().
|
static |
Definition at line 262 of file postmaster.c.
Referenced by LaunchMissingBackgroundProcesses(), PostmasterStateMachine(), and process_pm_child_exit().