PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <limits.h>
#include <unistd.h>
#include <signal.h>
#include "access/parallel.h"
#include "access/slru.h"
#include "access/transam.h"
#include "access/xact.h"
#include "catalog/pg_database.h"
#include "commands/async.h"
#include "funcapi.h"
#include "libpq/libpq.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "storage/ipc.h"
#include "storage/lmgr.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "storage/procsignal.h"
#include "storage/sinval.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
#include "utils/snapmgr.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Data Structures | |
struct | AsyncQueueEntry |
struct | QueuePosition |
struct | QueueBackendStatus |
struct | AsyncQueueControl |
struct | ListenAction |
struct | ActionList |
struct | Notification |
struct | NotificationList |
struct | NotificationHash |
Macros | |
#define | NOTIFY_PAYLOAD_MAX_LENGTH (BLCKSZ - NAMEDATALEN - 128) |
#define | QUEUEALIGN(len) INTALIGN(len) |
#define | AsyncQueueEntryEmptySize (offsetof(AsyncQueueEntry, data) + 2) |
#define | QUEUE_POS_PAGE(x) ((x).page) |
#define | QUEUE_POS_OFFSET(x) ((x).offset) |
#define | SET_QUEUE_POS(x, y, z) |
#define | QUEUE_POS_EQUAL(x, y) ((x).page == (y).page && (x).offset == (y).offset) |
#define | QUEUE_POS_MIN(x, y) |
#define | QUEUE_POS_MAX(x, y) |
#define | QUEUE_CLEANUP_DELAY 4 |
#define | QUEUE_HEAD (asyncQueueControl->head) |
#define | QUEUE_TAIL (asyncQueueControl->tail) |
#define | QUEUE_FIRST_LISTENER (asyncQueueControl->firstListener) |
#define | QUEUE_BACKEND_PID(i) (asyncQueueControl->backend[i].pid) |
#define | QUEUE_BACKEND_DBOID(i) (asyncQueueControl->backend[i].dboid) |
#define | QUEUE_NEXT_LISTENER(i) (asyncQueueControl->backend[i].nextListener) |
#define | QUEUE_BACKEND_POS(i) (asyncQueueControl->backend[i].pos) |
#define | AsyncCtl (&AsyncCtlData) |
#define | QUEUE_PAGESIZE BLCKSZ |
#define | QUEUE_FULL_WARN_INTERVAL 5000 /* warn at most once every 5s */ |
#define | QUEUE_MAX_PAGE (SLRU_PAGES_PER_SEGMENT * 0x10000 - 1) |
#define | MIN_HASHABLE_NOTIFIES 16 /* threshold to build hashtab */ |
Typedefs | |
typedef struct AsyncQueueEntry | AsyncQueueEntry |
typedef struct QueuePosition | QueuePosition |
typedef struct QueueBackendStatus | QueueBackendStatus |
typedef struct AsyncQueueControl | AsyncQueueControl |
typedef struct ActionList | ActionList |
typedef struct Notification | Notification |
typedef struct NotificationList | NotificationList |
typedef struct NotificationHash | NotificationHash |
Enumerations | |
enum | ListenActionKind { LISTEN_LISTEN, LISTEN_UNLISTEN, LISTEN_UNLISTEN_ALL } |
Variables | |
static AsyncQueueControl * | asyncQueueControl |
static SlruCtlData | AsyncCtlData |
static List * | listenChannels = NIL |
static ActionList * | pendingActions = NULL |
static NotificationList * | pendingNotifies = NULL |
volatile sig_atomic_t | notifyInterruptPending = false |
static bool | unlistenExitRegistered = false |
static bool | amRegisteredListener = false |
static bool | backendHasSentNotifications = false |
static bool | backendTryAdvanceTail = false |
bool | Trace_notify = false |
#define AsyncCtl (&AsyncCtlData) |
Definition at line 294 of file async.c.
Referenced by asyncQueueAddEntries(), asyncQueueAdvanceTail(), asyncQueueReadAllNotifications(), and AsyncShmemInit().
#define AsyncQueueEntryEmptySize (offsetof(AsyncQueueEntry, data) + 2) |
Definition at line 182 of file async.c.
Referenced by asyncQueueAdvance(), and asyncQueueNotificationToEntry().
#define MIN_HASHABLE_NOTIFIES 16 /* threshold to build hashtab */ |
Definition at line 399 of file async.c.
Referenced by AddEventToPendingNotifies().
#define NOTIFY_PAYLOAD_MAX_LENGTH (BLCKSZ - NAMEDATALEN - 128) |
Definition at line 156 of file async.c.
Referenced by Async_Notify(), and asyncQueueNotificationToEntry().
#define QUEUE_BACKEND_DBOID | ( | i | ) | (asyncQueueControl->backend[i].dboid) |
Definition at line 285 of file async.c.
Referenced by asyncQueueUnregister(), AsyncShmemInit(), Exec_ListenPreCommit(), and SignalBackends().
#define QUEUE_BACKEND_PID | ( | i | ) | (asyncQueueControl->backend[i].pid) |
Definition at line 284 of file async.c.
Referenced by asyncQueueAdvanceTail(), asyncQueueFillWarning(), asyncQueueReadAllNotifications(), asyncQueueUnregister(), AsyncShmemInit(), Exec_ListenPreCommit(), and SignalBackends().
#define QUEUE_BACKEND_POS | ( | i | ) | (asyncQueueControl->backend[i].pos) |
Definition at line 287 of file async.c.
Referenced by asyncQueueAdvanceTail(), asyncQueueFillWarning(), asyncQueueReadAllNotifications(), AsyncShmemInit(), Exec_ListenPreCommit(), and SignalBackends().
#define QUEUE_CLEANUP_DELAY 4 |
Definition at line 228 of file async.c.
Referenced by asyncQueueAddEntries(), and SignalBackends().
#define QUEUE_FIRST_LISTENER (asyncQueueControl->firstListener) |
Definition at line 283 of file async.c.
Referenced by asyncQueueAdvanceTail(), asyncQueueFillWarning(), asyncQueueUnregister(), AsyncShmemInit(), Exec_ListenPreCommit(), and SignalBackends().
#define QUEUE_FULL_WARN_INTERVAL 5000 /* warn at most once every 5s */ |
Definition at line 296 of file async.c.
Referenced by asyncQueueFillWarning().
#define QUEUE_HEAD (asyncQueueControl->head) |
Definition at line 281 of file async.c.
Referenced by asyncQueueAddEntries(), asyncQueueAdvanceTail(), asyncQueueFillWarning(), asyncQueueIsFull(), asyncQueueReadAllNotifications(), asyncQueueUsage(), AsyncShmemInit(), Exec_ListenPreCommit(), and SignalBackends().
#define QUEUE_MAX_PAGE (SLRU_PAGES_PER_SEGMENT * 0x10000 - 1) |
Definition at line 315 of file async.c.
Referenced by asyncQueueAdvance(), asyncQueueIsFull(), asyncQueuePageDiff(), and asyncQueueUsage().
#define QUEUE_NEXT_LISTENER | ( | i | ) | (asyncQueueControl->backend[i].nextListener) |
Definition at line 286 of file async.c.
Referenced by asyncQueueAdvanceTail(), asyncQueueFillWarning(), asyncQueueUnregister(), AsyncShmemInit(), Exec_ListenPreCommit(), and SignalBackends().
#define QUEUE_PAGESIZE BLCKSZ |
Definition at line 295 of file async.c.
Referenced by asyncQueueAddEntries(), asyncQueueAdvance(), and asyncQueueReadAllNotifications().
#define QUEUE_POS_EQUAL | ( | x, | |
y | |||
) | ((x).page == (y).page && (x).offset == (y).offset) |
Definition at line 202 of file async.c.
Referenced by asyncQueueFillWarning(), asyncQueueProcessPageEntries(), asyncQueueReadAllNotifications(), Exec_ListenPreCommit(), and SignalBackends().
#define QUEUE_POS_MAX | ( | x, | |
y | |||
) |
Definition at line 212 of file async.c.
Referenced by Exec_ListenPreCommit().
#define QUEUE_POS_MIN | ( | x, | |
y | |||
) |
Definition at line 206 of file async.c.
Referenced by asyncQueueAdvanceTail(), and asyncQueueFillWarning().
#define QUEUE_POS_OFFSET | ( | x | ) | ((x).offset) |
Definition at line 194 of file async.c.
Referenced by asyncQueueAddEntries(), asyncQueueAdvance(), asyncQueueProcessPageEntries(), and asyncQueueReadAllNotifications().
#define QUEUE_POS_PAGE | ( | x | ) | ((x).page) |
Definition at line 193 of file async.c.
Referenced by asyncQueueAddEntries(), asyncQueueAdvance(), asyncQueueAdvanceTail(), asyncQueueIsFull(), asyncQueueReadAllNotifications(), asyncQueueUsage(), AsyncShmemInit(), and SignalBackends().
#define QUEUE_TAIL (asyncQueueControl->tail) |
Definition at line 282 of file async.c.
Referenced by asyncQueueAdvanceTail(), asyncQueueIsFull(), asyncQueueUsage(), AsyncShmemInit(), and Exec_ListenPreCommit().
#define QUEUEALIGN | ( | len | ) | INTALIGN(len) |
Definition at line 180 of file async.c.
Referenced by asyncQueueAdvance(), and asyncQueueNotificationToEntry().
#define SET_QUEUE_POS | ( | x, | |
y, | |||
z | |||
) |
Definition at line 196 of file async.c.
Referenced by asyncQueueAdvance(), and AsyncShmemInit().
typedef struct ActionList ActionList |
typedef struct AsyncQueueControl AsyncQueueControl |
typedef struct AsyncQueueEntry AsyncQueueEntry |
typedef struct Notification Notification |
typedef struct NotificationHash NotificationHash |
typedef struct NotificationList NotificationList |
typedef struct QueueBackendStatus QueueBackendStatus |
typedef struct QueuePosition QueuePosition |
enum ListenActionKind |
Enumerator | |
---|---|
LISTEN_LISTEN | |
LISTEN_UNLISTEN | |
LISTEN_UNLISTEN_ALL |
|
static |
Definition at line 2321 of file async.c.
References Assert, CurTransactionContext, HASHCTL::entrysize, NotificationHash::event, NotificationList::events, HASHCTL::hash, HASH_COMPARE, HASH_CONTEXT, hash_create(), HASH_ELEM, HASH_ENTER, HASH_FUNCTION, hash_search(), NotificationList::hashtab, HASHCTL::hcxt, HASHCTL::keysize, lappend(), lfirst, list_length(), HASHCTL::match, MemSet, MIN_HASHABLE_NOTIFIES, NIL, notification_hash(), and notification_match().
Referenced by Async_Notify(), and AtSubCommit_Notify().
void Async_Listen | ( | const char * | channel | ) |
Definition at line 762 of file async.c.
References DEBUG1, elog, LISTEN_LISTEN, MyProcPid, queue_listen(), and Trace_notify.
Referenced by standard_ProcessUtility().
void Async_Notify | ( | const char * | channel, |
const char * | payload | ||
) |
Definition at line 615 of file async.c.
References AddEventToPendingNotifies(), AsyncExistsPendingNotify(), Notification::channel_len, CurTransactionContext, AsyncQueueEntry::data, Notification::data, DEBUG1, elog, ereport, errcode(), errmsg(), ERROR, NotificationList::events, GetCurrentTransactionNestLevel(), NotificationList::hashtab, IsParallelWorker, list_make1, MemoryContextAlloc(), MemoryContextSwitchTo(), NAMEDATALEN, NotificationList::nestingLevel, NOTIFY_PAYLOAD_MAX_LENGTH, offsetof, palloc(), Notification::payload_len, pendingNotifies, pfree(), TopTransactionContext, Trace_notify, and NotificationList::upper.
Referenced by pg_notify(), standard_ProcessUtility(), and triggered_change_notification().
void Async_Unlisten | ( | const char * | channel | ) |
Definition at line 776 of file async.c.
References DEBUG1, elog, LISTEN_UNLISTEN, MyProcPid, queue_listen(), Trace_notify, and unlistenExitRegistered.
Referenced by standard_ProcessUtility().
void Async_UnlistenAll | ( | void | ) |
Definition at line 794 of file async.c.
References DEBUG1, elog, LISTEN_UNLISTEN_ALL, MyProcPid, queue_listen(), Trace_notify, and unlistenExitRegistered.
Referenced by DiscardAll(), and standard_ProcessUtility().
|
static |
Definition at line 847 of file async.c.
References asyncQueueUnregister(), and Exec_UnlistenAllCommit().
Referenced by Exec_ListenPreCommit().
|
static |
Definition at line 2280 of file async.c.
References Notification::channel_len, Notification::data, NotificationList::events, HASH_FIND, hash_search(), NotificationList::hashtab, lfirst, and Notification::payload_len.
Referenced by Async_Notify(), and AtSubCommit_Notify().
Definition at line 1449 of file async.c.
References AsyncCtl, asyncQueueAdvance(), asyncQueueNotificationToEntry(), backendTryAdvanceTail, AsyncQueueEntry::data, AsyncQueueEntry::dboid, NotificationList::events, InvalidOid, InvalidTransactionId, AsyncQueueEntry::length, lfirst, lnext(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), QUEUE_CLEANUP_DELAY, QUEUE_HEAD, QUEUE_PAGESIZE, QUEUE_POS_OFFSET, QUEUE_POS_PAGE, SimpleLruReadPage(), and SimpleLruZeroPage().
Referenced by PreCommit_Notify().
|
static |
Definition at line 1378 of file async.c.
References Assert, AsyncQueueEntryEmptySize, QUEUE_MAX_PAGE, QUEUE_PAGESIZE, QUEUE_POS_OFFSET, QUEUE_POS_PAGE, QUEUEALIGN, and SET_QUEUE_POS.
Referenced by asyncQueueAddEntries(), and asyncQueueProcessPageEntries().
|
static |
Definition at line 2166 of file async.c.
References Assert, AsyncCtl, asyncQueuePagePrecedes(), i, InvalidPid, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), QUEUE_BACKEND_PID, QUEUE_BACKEND_POS, QUEUE_FIRST_LISTENER, QUEUE_HEAD, QUEUE_NEXT_LISTENER, QUEUE_POS_MIN, QUEUE_POS_PAGE, QUEUE_TAIL, SimpleLruTruncate(), and SLRU_PAGES_PER_SEGMENT.
Referenced by pg_notification_queue_usage(), and ProcessCompletedNotifies().
|
static |
Definition at line 1600 of file async.c.
References Assert, asyncQueueUsage(), ereport, errdetail(), errhint(), errmsg(), GetCurrentTimestamp(), i, InvalidPid, AsyncQueueControl::lastQueueFillWarn, QUEUE_BACKEND_PID, QUEUE_BACKEND_POS, QUEUE_FIRST_LISTENER, QUEUE_FULL_WARN_INTERVAL, QUEUE_HEAD, QUEUE_NEXT_LISTENER, QUEUE_POS_EQUAL, QUEUE_POS_MIN, TimestampDifferenceExceeds(), and WARNING.
Referenced by PreCommit_Notify().
|
static |
Definition at line 1347 of file async.c.
References asyncQueuePagePrecedes(), QUEUE_HEAD, QUEUE_MAX_PAGE, QUEUE_POS_PAGE, QUEUE_TAIL, and SLRU_PAGES_PER_SEGMENT.
Referenced by PreCommit_Notify().
|
static |
Definition at line 1413 of file async.c.
References Assert, AsyncQueueEntryEmptySize, Notification::channel_len, AsyncQueueEntry::data, Notification::data, AsyncQueueEntry::dboid, GetCurrentTransactionId(), AsyncQueueEntry::length, MyDatabaseId, MyProcPid, NAMEDATALEN, NOTIFY_PAYLOAD_MAX_LENGTH, Notification::payload_len, QUEUEALIGN, AsyncQueueEntry::srcPid, and AsyncQueueEntry::xid.
Referenced by asyncQueueAddEntries().
|
static |
Definition at line 468 of file async.c.
References Assert, and QUEUE_MAX_PAGE.
Referenced by asyncQueuePagePrecedes(), and SignalBackends().
|
static |
Definition at line 489 of file async.c.
References asyncQueuePageDiff().
Referenced by asyncQueueAdvanceTail(), asyncQueueIsFull(), and AsyncShmemInit().
|
static |
Definition at line 2077 of file async.c.
References asyncQueueAdvance(), AsyncQueueEntry::data, AsyncQueueEntry::dboid, IsListeningOn(), AsyncQueueEntry::length, MyDatabaseId, NotifyMyFrontEnd(), QUEUE_POS_EQUAL, QUEUE_POS_OFFSET, AsyncQueueEntry::srcPid, TransactionIdDidCommit(), AsyncQueueEntry::xid, and XidInMVCCSnapshot().
Referenced by asyncQueueReadAllNotifications().
|
static |
Definition at line 1911 of file async.c.
References Assert, AsyncCtl, asyncQueueProcessPageEntries(), buf, GetLatestSnapshot(), InvalidTransactionId, LW_SHARED, LWLockAcquire(), LWLockRelease(), MyBackendId, MyProcPid, PG_END_TRY, PG_FINALLY, PG_TRY, QUEUE_BACKEND_PID, QUEUE_BACKEND_POS, QUEUE_HEAD, QUEUE_PAGESIZE, QUEUE_POS_EQUAL, QUEUE_POS_OFFSET, QUEUE_POS_PAGE, RegisterSnapshot(), SimpleLruReadPage_ReadOnly(), and UnregisterSnapshot().
Referenced by Exec_ListenPreCommit(), ProcessCompletedNotifies(), and ProcessIncomingNotify().
|
static |
Definition at line 1306 of file async.c.
References amRegisteredListener, Assert, i, InvalidBackendId, InvalidOid, InvalidPid, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyBackendId, NIL, QUEUE_BACKEND_DBOID, QUEUE_BACKEND_PID, QUEUE_FIRST_LISTENER, and QUEUE_NEXT_LISTENER.
Referenced by Async_UnlistenOnExit(), AtAbort_Notify(), and AtCommit_Notify().
|
static |
Definition at line 1571 of file async.c.
References QUEUE_HEAD, QUEUE_MAX_PAGE, QUEUE_POS_PAGE, and QUEUE_TAIL.
Referenced by asyncQueueFillWarning(), and pg_notification_queue_usage().
void AsyncShmemInit | ( | void | ) |
Definition at line 515 of file async.c.
References add_size(), AsyncCtl, asyncQueuePagePrecedes(), i, InvalidBackendId, InvalidOid, InvalidPid, AsyncQueueControl::lastQueueFillWarn, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), LWTRANCHE_ASYNC_BUFFERS, MaxBackends, mul_size(), NUM_ASYNC_BUFFERS, offsetof, QUEUE_BACKEND_DBOID, QUEUE_BACKEND_PID, QUEUE_BACKEND_POS, QUEUE_FIRST_LISTENER, QUEUE_HEAD, QUEUE_NEXT_LISTENER, QUEUE_POS_PAGE, QUEUE_TAIL, SET_QUEUE_POS, ShmemInitStruct(), SimpleLruInit(), SimpleLruWritePage(), SimpleLruZeroPage(), SlruScanDirCbDeleteAll(), and SlruScanDirectory().
Referenced by CreateSharedMemoryAndSemaphores().
Size AsyncShmemSize | ( | void | ) |
Definition at line 498 of file async.c.
References add_size(), MaxBackends, mul_size(), NUM_ASYNC_BUFFERS, offsetof, and SimpleLruShmemSize().
Referenced by CreateSharedMemoryAndSemaphores().
void AtAbort_Notify | ( | void | ) |
Definition at line 1736 of file async.c.
References amRegisteredListener, asyncQueueUnregister(), ClearPendingActionsAndNotifies(), and NIL.
Referenced by AbortTransaction().
void AtCommit_Notify | ( | void | ) |
Definition at line 987 of file async.c.
References ListenAction::action, ActionList::actions, amRegisteredListener, asyncQueueUnregister(), ListenAction::channel, ClearPendingActionsAndNotifies(), DEBUG1, elog, Exec_ListenCommit(), Exec_UnlistenAllCommit(), Exec_UnlistenCommit(), lfirst, LISTEN_LISTEN, LISTEN_UNLISTEN, LISTEN_UNLISTEN_ALL, NIL, and Trace_notify.
Referenced by CommitTransaction().
void AtPrepare_Notify | ( | void | ) |
void AtSubAbort_Notify | ( | void | ) |
Definition at line 1826 of file async.c.
References GetCurrentTransactionNestLevel(), ActionList::nestingLevel, NotificationList::nestingLevel, pendingActions, pendingNotifies, pfree(), ActionList::upper, and NotificationList::upper.
Referenced by AbortSubTransaction().
void AtSubCommit_Notify | ( | void | ) |
Definition at line 1756 of file async.c.
References ActionList::actions, AddEventToPendingNotifies(), Assert, AsyncExistsPendingNotify(), NotificationList::events, GetCurrentTransactionNestLevel(), lfirst, list_concat(), ActionList::nestingLevel, NotificationList::nestingLevel, pendingActions, pendingNotifies, pfree(), ActionList::upper, and NotificationList::upper.
Referenced by CommitSubTransaction().
|
static |
|
static |
Definition at line 1132 of file async.c.
References IsListeningOn(), lappend(), MemoryContextSwitchTo(), pstrdup(), and TopMemoryContext.
Referenced by AtCommit_Notify().
|
static |
Definition at line 1037 of file async.c.
References amRegisteredListener, Async_UnlistenOnExit(), asyncQueueReadAllNotifications(), before_shmem_exit(), DEBUG1, elog, i, InvalidBackendId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyBackendId, MyDatabaseId, MyProcPid, QUEUE_BACKEND_DBOID, QUEUE_BACKEND_PID, QUEUE_BACKEND_POS, QUEUE_FIRST_LISTENER, QUEUE_HEAD, QUEUE_NEXT_LISTENER, QUEUE_POS_EQUAL, QUEUE_POS_MAX, QUEUE_TAIL, Trace_notify, and unlistenExitRegistered.
Referenced by PreCommit_Notify().
|
static |
Definition at line 1190 of file async.c.
References DEBUG1, elog, list_free_deep(), MyProcPid, NIL, and Trace_notify.
Referenced by Async_UnlistenOnExit(), and AtCommit_Notify().
|
static |
Definition at line 1159 of file async.c.
References DEBUG1, elog, foreach_delete_current, lfirst, MyProcPid, pfree(), and Trace_notify.
Referenced by AtCommit_Notify().
void HandleNotifyInterrupt | ( | void | ) |
Definition at line 1869 of file async.c.
References MyLatch, notifyInterruptPending, and SetLatch().
Referenced by procsignal_sigusr1_handler().
|
static |
Definition at line 1287 of file async.c.
References lfirst.
Referenced by asyncQueueProcessPageEntries(), and Exec_ListenCommit().
Definition at line 2385 of file async.c.
References Assert, Notification::channel_len, Notification::data, DatumGetUInt32, hash_any(), and Notification::payload_len.
Referenced by AddEventToPendingNotifies().
|
static |
Definition at line 2399 of file async.c.
References Assert, Notification::channel_len, Notification::data, and Notification::payload_len.
Referenced by AddEventToPendingNotifies().
void NotifyMyFrontEnd | ( | const char * | channel, |
const char * | payload, | ||
int32 | srcPid | ||
) |
Definition at line 2255 of file async.c.
References buf, DestRemote, elog, FrontendProtocol, INFO, PG_PROTOCOL_MAJOR, pq_beginmessage(), pq_endmessage(), pq_sendint32(), pq_sendstring(), and whereToSendOutput.
Referenced by asyncQueueProcessPageEntries(), and HandleParallelMessage().
Datum pg_listening_channels | ( | PG_FUNCTION_ARGS | ) |
Definition at line 814 of file async.c.
References FuncCallContext::call_cntr, CStringGetTextDatum, list_length(), list_nth(), SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, and SRF_RETURN_NEXT.
Datum pg_notification_queue_usage | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1551 of file async.c.
References asyncQueueAdvanceTail(), asyncQueueUsage(), LW_SHARED, LWLockAcquire(), LWLockRelease(), PG_RETURN_FLOAT8, and usage().
Datum pg_notify | ( | PG_FUNCTION_ARGS | ) |
Definition at line 581 of file async.c.
References Async_Notify(), PG_ARGISNULL, PG_GETARG_TEXT_PP, PG_RETURN_VOID, PreventCommandDuringRecovery(), and text_to_cstring().
void PreCommit_Notify | ( | void | ) |
Definition at line 885 of file async.c.
References AccessExclusiveLock, ListenAction::action, ActionList::actions, asyncQueueAddEntries(), asyncQueueFillWarning(), asyncQueueIsFull(), backendHasSentNotifications, DEBUG1, elog, ereport, errcode(), errmsg(), ERROR, NotificationList::events, Exec_ListenPreCommit(), GetCurrentTransactionId(), InvalidOid, lfirst, list_head(), LISTEN_LISTEN, LISTEN_UNLISTEN, LISTEN_UNLISTEN_ALL, LockSharedObject(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), and Trace_notify.
Referenced by CommitTransaction().
void ProcessCompletedNotifies | ( | void | ) |
Definition at line 1223 of file async.c.
References asyncQueueAdvanceTail(), asyncQueueReadAllNotifications(), backendHasSentNotifications, backendTryAdvanceTail, CommitTransactionCommand(), CurrentMemoryContext, DEBUG1, elog, MemoryContextSwitchTo(), NIL, SignalBackends(), StartTransactionCommand(), and Trace_notify.
Referenced by PostgresMain().
|
static |
Definition at line 2216 of file async.c.
References asyncQueueReadAllNotifications(), CommitTransactionCommand(), DEBUG1, elog, NIL, notifyInterruptPending, pq_flush, set_ps_display(), StartTransactionCommand(), and Trace_notify.
Referenced by ProcessNotifyInterrupt().
void ProcessNotifyInterrupt | ( | void | ) |
Definition at line 1895 of file async.c.
References IsTransactionOrTransactionBlock(), notifyInterruptPending, and ProcessIncomingNotify().
Referenced by PostgresMain(), and ProcessClientReadInterrupt().
|
static |
Definition at line 714 of file async.c.
References generate_unaccent_rules::action, ListenAction::action, ActionList::actions, ListenAction::channel, CurTransactionContext, GetCurrentTransactionNestLevel(), lappend(), list_make1, MemoryContextAlloc(), MemoryContextSwitchTo(), ActionList::nestingLevel, offsetof, palloc(), pendingActions, TopTransactionContext, and ActionList::upper.
Referenced by Async_Listen(), Async_Unlisten(), and Async_UnlistenAll().
|
static |
Definition at line 1653 of file async.c.
References Assert, asyncQueuePageDiff(), DEBUG3, elog, i, InvalidPid, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaxBackends, MyDatabaseId, MyProcPid, palloc(), pfree(), PROCSIG_NOTIFY_INTERRUPT, QUEUE_BACKEND_DBOID, QUEUE_BACKEND_PID, QUEUE_BACKEND_POS, QUEUE_CLEANUP_DELAY, QUEUE_FIRST_LISTENER, QUEUE_HEAD, QUEUE_NEXT_LISTENER, QUEUE_POS_EQUAL, QUEUE_POS_PAGE, and SendProcSignal().
Referenced by ProcessCompletedNotifies().
Definition at line 421 of file async.c.
Referenced by asyncQueueUnregister(), AtAbort_Notify(), AtCommit_Notify(), and Exec_ListenPreCommit().
|
static |
|
static |
Definition at line 424 of file async.c.
Referenced by PreCommit_Notify(), and ProcessCompletedNotifies().
Definition at line 427 of file async.c.
Referenced by asyncQueueAddEntries(), and ProcessCompletedNotifies().
volatile sig_atomic_t notifyInterruptPending = false |
Definition at line 415 of file async.c.
Referenced by HandleNotifyInterrupt(), PostgresMain(), ProcessClientReadInterrupt(), ProcessIncomingNotify(), and ProcessNotifyInterrupt().
|
static |
Definition at line 354 of file async.c.
Referenced by AtSubAbort_Notify(), AtSubCommit_Notify(), and queue_listen().
|
static |
Definition at line 406 of file async.c.
Referenced by Async_Notify(), AtSubAbort_Notify(), and AtSubCommit_Notify().
Definition at line 430 of file async.c.
Referenced by Async_Listen(), Async_Notify(), Async_Unlisten(), Async_UnlistenAll(), AtCommit_Notify(), Exec_ListenPreCommit(), Exec_UnlistenAllCommit(), Exec_UnlistenCommit(), PreCommit_Notify(), ProcessCompletedNotifies(), and ProcessIncomingNotify().
Definition at line 418 of file async.c.
Referenced by Async_Unlisten(), Async_UnlistenAll(), and Exec_ListenPreCommit().