PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <sys/time.h>
#include "miscadmin.h"
#include "storage/latch.h"
#include "utils/timeout.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Data Structures | |
struct | timeout_params |
Macros | |
#define | disable_alarm() (alarm_enabled = false) |
#define | enable_alarm() (alarm_enabled = true) |
Typedefs | |
typedef struct timeout_params | timeout_params |
Variables | |
static timeout_params | all_timeouts [MAX_TIMEOUTS] |
static bool | all_timeouts_initialized = false |
static volatile int | num_active_timeouts = 0 |
static timeout_params *volatile | active_timeouts [MAX_TIMEOUTS] |
static volatile sig_atomic_t | alarm_enabled = false |
static volatile sig_atomic_t | signal_pending = false |
static volatile TimestampTz | signal_due_at = 0 |
#define disable_alarm | ( | ) | (alarm_enabled = false) |
#define enable_alarm | ( | ) | (alarm_enabled = true) |
typedef struct timeout_params timeout_params |
void disable_all_timeouts | ( | bool | keep_indicators | ) |
Definition at line 751 of file timeout.c.
References timeout_params::active, all_timeouts, disable_alarm, i, timeout_params::indicator, MAX_TIMEOUTS, and num_active_timeouts.
Referenced by pgarch_archiveXlog(), PostgresMain(), ResolveRecoveryConflictWithBufferPin(), and ResolveRecoveryConflictWithLock().
Definition at line 685 of file timeout.c.
References all_timeouts, all_timeouts_initialized, Assert, disable_alarm, find_active_timeout(), GetCurrentTimestamp(), timeout_params::indicator, num_active_timeouts, remove_timeout_index(), and schedule_alarm().
Referenced by AbortTransaction(), assign_transaction_timeout(), BackendInitialize(), CommitTransaction(), disable_startup_progress_timeout(), disable_statement_timeout(), enable_statement_timeout(), PerformAuthentication(), PostgresMain(), PrepareTransaction(), and ProcSleep().
void disable_timeouts | ( | const DisableTimeoutParams * | timeouts, |
int | count | ||
) |
Definition at line 718 of file timeout.c.
References all_timeouts, all_timeouts_initialized, Assert, disable_alarm, find_active_timeout(), GetCurrentTimestamp(), i, DisableTimeoutParams::id, timeout_params::indicator, num_active_timeouts, remove_timeout_index(), and schedule_alarm().
Referenced by LockErrorCleanup(), and ProcSleep().
|
static |
Definition at line 158 of file timeout.c.
References active_timeouts, all_timeouts, all_timeouts_initialized, Assert, timeout_params::fin_time, find_active_timeout(), i, timeout_params::indicator, insert_timeout(), timeout_params::interval_in_ms, now(), num_active_timeouts, remove_timeout_index(), and timeout_params::start_time.
Referenced by enable_timeout_after(), enable_timeout_at(), enable_timeout_every(), enable_timeouts(), and handle_sig_alarm().
void enable_timeout_after | ( | TimeoutId | id, |
int | delay_ms | ||
) |
Definition at line 560 of file timeout.c.
References disable_alarm, enable_timeout(), GetCurrentTimestamp(), now(), schedule_alarm(), and TimestampTzPlusMilliseconds.
Referenced by assign_transaction_timeout(), BackendInitialize(), enable_statement_timeout(), PerformAuthentication(), PostgresMain(), ProcessInterrupts(), ProcSleep(), start_xact_command(), and StartTransaction().
void enable_timeout_at | ( | TimeoutId | id, |
TimestampTz | fin_time | ||
) |
Definition at line 607 of file timeout.c.
References disable_alarm, enable_timeout(), GetCurrentTimestamp(), now(), and schedule_alarm().
void enable_timeout_every | ( | TimeoutId | id, |
TimestampTz | fin_time, | ||
int | delay_ms | ||
) |
Definition at line 584 of file timeout.c.
References disable_alarm, enable_timeout(), GetCurrentTimestamp(), now(), and schedule_alarm().
Referenced by enable_startup_progress_timeout().
void enable_timeouts | ( | const EnableTimeoutParams * | timeouts, |
int | count | ||
) |
Definition at line 630 of file timeout.c.
References disable_alarm, elog, enable_timeout(), ERROR, GetCurrentTimestamp(), i, EnableTimeoutParams::id, now(), schedule_alarm(), TimestampTzPlusMilliseconds, TMPARAM_AFTER, TMPARAM_AT, TMPARAM_EVERY, and type.
Referenced by ProcSleep(), ResolveRecoveryConflictWithBufferPin(), and ResolveRecoveryConflictWithLock().
|
static |
Definition at line 96 of file timeout.c.
References active_timeouts, i, and num_active_timeouts.
Referenced by disable_timeout(), disable_timeouts(), and enable_timeout().
Definition at line 780 of file timeout.c.
References timeout_params::active, and all_timeouts.
Referenced by assign_transaction_timeout(), disable_statement_timeout(), enable_statement_timeout(), PostgresMain(), and start_xact_command().
TimestampTz get_timeout_finish_time | ( | TimeoutId | id | ) |
Definition at line 827 of file timeout.c.
References all_timeouts, and timeout_params::fin_time.
Referenced by ProcessInterrupts().
Definition at line 793 of file timeout.c.
References all_timeouts, and timeout_params::indicator.
Referenced by ProcessInterrupts().
TimestampTz get_timeout_start_time | ( | TimeoutId | id | ) |
Definition at line 813 of file timeout.c.
References all_timeouts, and timeout_params::start_time.
Referenced by ProcSleep().
|
static |
Definition at line 364 of file timeout.c.
References active_timeouts, alarm_enabled, disable_alarm, enable_timeout(), timeout_params::fin_time, GetCurrentTimestamp(), HOLD_INTERRUPTS, timeout_params::index, timeout_params::indicator, timeout_params::interval_in_ms, MyLatch, now(), num_active_timeouts, remove_timeout_index(), RESUME_INTERRUPTS, schedule_alarm(), SetLatch(), signal_pending, timeout_params::timeout_handler, and TimestampTzPlusMilliseconds.
Referenced by InitializeTimeouts().
void InitializeTimeouts | ( | void | ) |
Definition at line 470 of file timeout.c.
References timeout_params::active, all_timeouts, all_timeouts_initialized, disable_alarm, timeout_params::fin_time, handle_sig_alarm(), i, timeout_params::index, timeout_params::indicator, timeout_params::interval_in_ms, MAX_TIMEOUTS, num_active_timeouts, pqsignal(), SIGALRM, timeout_params::start_time, and timeout_params::timeout_handler.
Referenced by AutoVacWorkerMain(), BackendInitialize(), BackgroundWorkerMain(), PostgresMain(), ReplSlotSyncWorkerMain(), StartupProcessMain(), and WalSndSignals().
|
static |
Definition at line 114 of file timeout.c.
References timeout_params::active, active_timeouts, all_timeouts, Assert, elog, FATAL, i, and num_active_timeouts.
Referenced by enable_timeout().
TimeoutId RegisterTimeout | ( | TimeoutId | id, |
timeout_handler_proc | handler | ||
) |
Definition at line 505 of file timeout.c.
References all_timeouts, all_timeouts_initialized, Assert, ereport, errcode(), errmsg(), FATAL, MAX_TIMEOUTS, timeout_params::timeout_handler, and USER_TIMEOUT.
Referenced by BackendInitialize(), InitPostgres(), StartupProcessMain(), and StartupXLOG().
|
static |
Definition at line 137 of file timeout.c.
References timeout_params::active, active_timeouts, Assert, elog, FATAL, i, and num_active_timeouts.
Referenced by disable_timeout(), disable_timeouts(), enable_timeout(), and handle_sig_alarm().
void reschedule_timeouts | ( | void | ) |
Definition at line 540 of file timeout.c.
References all_timeouts_initialized, disable_alarm, GetCurrentTimestamp(), num_active_timeouts, and schedule_alarm().
Referenced by AbortSubTransaction(), and AbortTransaction().
|
static |
Definition at line 210 of file timeout.c.
References active_timeouts, elog, enable_alarm, FATAL, timeout_params::fin_time, itimerval::it_value, ITIMER_REAL, MemSet, now(), num_active_timeouts, setitimer(), signal_due_at, signal_pending, and TimestampDifference().
Referenced by disable_timeout(), disable_timeouts(), enable_timeout_after(), enable_timeout_at(), enable_timeout_every(), enable_timeouts(), handle_sig_alarm(), and reschedule_timeouts().
|
static |
Definition at line 53 of file timeout.c.
Referenced by enable_timeout(), find_active_timeout(), handle_sig_alarm(), insert_timeout(), remove_timeout_index(), and schedule_alarm().
|
static |
Definition at line 67 of file timeout.c.
Referenced by handle_sig_alarm().
|
static |
Definition at line 45 of file timeout.c.
Referenced by disable_all_timeouts(), disable_timeout(), disable_timeouts(), enable_timeout(), get_timeout_active(), get_timeout_finish_time(), get_timeout_indicator(), get_timeout_start_time(), InitializeTimeouts(), insert_timeout(), and RegisterTimeout().
Definition at line 46 of file timeout.c.
Referenced by disable_timeout(), disable_timeouts(), enable_timeout(), InitializeTimeouts(), RegisterTimeout(), and reschedule_timeouts().
|
static |
Definition at line 52 of file timeout.c.
Referenced by disable_all_timeouts(), disable_timeout(), disable_timeouts(), enable_timeout(), find_active_timeout(), handle_sig_alarm(), InitializeTimeouts(), insert_timeout(), remove_timeout_index(), reschedule_timeouts(), and schedule_alarm().
|
static |
Definition at line 79 of file timeout.c.
Referenced by schedule_alarm().
|
static |
Definition at line 78 of file timeout.c.
Referenced by handle_sig_alarm(), and schedule_alarm().