#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 "common/hashfn.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/procsignal.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/guc_hooks.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.
Enumerator | |
---|---|
LISTEN_LISTEN | |
LISTEN_UNLISTEN | |
LISTEN_UNLISTEN_ALL |
Definition at line 2289 of file async.c.
References Assert(), CurTransactionContext, HASHCTL::entrysize, 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, MIN_HASHABLE_NOTIFIES, NIL, notification_hash(), notification_match(), and pendingNotifies.
Referenced by Async_Notify(), and AtSubCommit_Notify().
Definition at line 738 of file async.c.
References DEBUG1, elog, LISTEN_LISTEN, MyProcPid, queue_listen(), and Trace_notify.
Referenced by standard_ProcessUtility().
Definition at line 591 of file async.c.
References AddEventToPendingNotifies(), AsyncExistsPendingNotify(), Notification::channel_len, CurTransactionContext, Notification::data, data, DEBUG1, elog, ereport, errcode(), errmsg(), ERROR, NotificationList::events, GetCurrentTransactionNestLevel(), NotificationList::hashtab, IsParallelWorker, list_make1, MemoryContextAlloc(), MemoryContextSwitchTo(), NAMEDATALEN, NotificationList::nestingLevel, NOTIFY_PAYLOAD_MAX_LENGTH, palloc(), Notification::payload_len, pendingNotifies, pfree(), TopTransactionContext, Trace_notify, and NotificationList::upper.
Referenced by pg_notify(), standard_ProcessUtility(), and triggered_change_notification().
Definition at line 752 of file async.c.
References DEBUG1, elog, LISTEN_UNLISTEN, MyProcPid, pendingActions, queue_listen(), Trace_notify, and unlistenExitRegistered.
Referenced by standard_ProcessUtility().
Definition at line 770 of file async.c.
References DEBUG1, elog, LISTEN_UNLISTEN_ALL, MyProcPid, pendingActions, queue_listen(), Trace_notify, and unlistenExitRegistered.
Referenced by DiscardAll(), and standard_ProcessUtility().
Definition at line 823 of file async.c.
References asyncQueueUnregister(), and Exec_UnlistenAllCommit().
Referenced by Exec_ListenPreCommit().
Definition at line 2248 of file async.c.
References Notification::channel_len, Notification::data, NotificationList::events, HASH_FIND, hash_search(), NotificationList::hashtab, lfirst, Notification::payload_len, and pendingNotifies.
Referenced by Async_Notify(), and AtSubCommit_Notify().
Definition at line 1356 of file async.c.
References asyncQueueAdvance(), asyncQueueNotificationToEntry(), AsyncQueueEntry::data, AsyncQueueEntry::dboid, NotificationList::events, InvalidOid, InvalidTransactionId, AsyncQueueEntry::length, lfirst, lnext(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), NotifyCtl, pendingNotifies, QUEUE_CLEANUP_DELAY, QUEUE_HEAD, QUEUE_PAGESIZE, QUEUE_POS_IS_ZERO, QUEUE_POS_OFFSET, QUEUE_POS_PAGE, SimpleLruGetBankLock(), SimpleLruReadPage(), SimpleLruZeroPage(), and tryAdvanceTail.
Referenced by PreCommit_Notify().
Definition at line 1287 of file async.c.
References Assert(), AsyncQueueEntryEmptySize, QUEUE_PAGESIZE, QUEUE_POS_OFFSET, QUEUE_POS_PAGE, QUEUEALIGN, and SET_QUEUE_POS.
Referenced by asyncQueueAddEntries(), and asyncQueueProcessPageEntries().
Definition at line 2108 of file async.c.
References Assert(), asyncQueuePagePrecedes(), i, INVALID_PROC_NUMBER, InvalidPid, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), NotifyCtl, QUEUE_BACKEND_PID, QUEUE_BACKEND_POS, QUEUE_FIRST_LISTENER, QUEUE_HEAD, QUEUE_NEXT_LISTENER, QUEUE_POS_MIN, QUEUE_POS_PAGE, QUEUE_STOP_PAGE, QUEUE_TAIL, SimpleLruTruncate(), and SLRU_PAGES_PER_SEGMENT.
Referenced by AtCommit_Notify(), and pg_notification_queue_usage().
Definition at line 1527 of file async.c.
References Assert(), asyncQueueControl, asyncQueueUsage(), ereport, errdetail(), errhint(), errmsg(), GetCurrentTimestamp(), i, INVALID_PROC_NUMBER, 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().
Definition at line 1272 of file async.c.
References max_notify_queue_pages, QUEUE_HEAD, QUEUE_POS_PAGE, and QUEUE_TAIL.
Referenced by PreCommit_Notify().
Definition at line 1320 of file async.c.
References Assert(), AsyncQueueEntryEmptySize, Notification::channel_len, Notification::data, AsyncQueueEntry::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().
Definition at line 476 of file async.c.
Referenced by asyncQueueAdvanceTail(), and AsyncShmemInit().
Definition at line 2016 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().
Definition at line 1851 of file async.c.
References Assert(), asyncQueueProcessPageEntries(), buf, GetLatestSnapshot(), InvalidTransactionId, LW_SHARED, LWLockAcquire(), LWLockRelease(), MyProcNumber, MyProcPid, NotifyCtl, 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(), SimpleLruGetBankLock(), SimpleLruReadPage_ReadOnly(), and UnregisterSnapshot().
Referenced by Exec_ListenPreCommit(), and ProcessIncomingNotify().
Definition at line 1231 of file async.c.
References amRegisteredListener, Assert(), i, INVALID_PROC_NUMBER, InvalidOid, InvalidPid, listenChannels, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProcNumber, NIL, QUEUE_BACKEND_DBOID, QUEUE_BACKEND_PID, QUEUE_FIRST_LISTENER, and QUEUE_NEXT_LISTENER.
Referenced by Async_UnlistenOnExit(), AtAbort_Notify(), and AtCommit_Notify().
Definition at line 1506 of file async.c.
References max_notify_queue_pages, QUEUE_HEAD, QUEUE_POS_PAGE, and QUEUE_TAIL.
Referenced by asyncQueueFillWarning(), and pg_notification_queue_usage().
Definition at line 502 of file async.c.
References add_size(), asyncQueueControl, asyncQueuePagePrecedes(), i, INVALID_PROC_NUMBER, InvalidOid, InvalidPid, AsyncQueueControl::lastQueueFillWarn, MaxBackends, mul_size(), notify_buffers, NotifyCtl, QUEUE_BACKEND_DBOID, QUEUE_BACKEND_PID, QUEUE_BACKEND_POS, QUEUE_FIRST_LISTENER, QUEUE_HEAD, QUEUE_NEXT_LISTENER, QUEUE_STOP_PAGE, QUEUE_TAIL, SET_QUEUE_POS, ShmemInitStruct(), SimpleLruInit(), SlruScanDirCbDeleteAll(), SlruScanDirectory(), and SYNC_HANDLER_NONE.
Referenced by CreateOrAttachShmemStructs().
Definition at line 485 of file async.c.
References add_size(), MaxBackends, mul_size(), notify_buffers, and SimpleLruShmemSize().
Referenced by CalculateShmemSize().
Definition at line 1671 of file async.c.
References amRegisteredListener, asyncQueueUnregister(), ClearPendingActionsAndNotifies(), listenChannels, and NIL.
Referenced by AbortTransaction().
Definition at line 968 of file async.c.
References ListenAction::action, ActionList::actions, amRegisteredListener, asyncQueueAdvanceTail(), asyncQueueUnregister(), ListenAction::channel, ClearPendingActionsAndNotifies(), DEBUG1, elog, Exec_ListenCommit(), Exec_UnlistenAllCommit(), Exec_UnlistenCommit(), lfirst, LISTEN_LISTEN, LISTEN_UNLISTEN, LISTEN_UNLISTEN_ALL, listenChannels, NIL, pendingActions, pendingNotifies, SignalBackends(), Trace_notify, and tryAdvanceTail.
Referenced by CommitTransaction().
Definition at line 836 of file async.c.
References ereport, errcode(), errmsg(), ERROR, pendingActions, and pendingNotifies.
Referenced by PrepareTransaction().
Definition at line 1761 of file async.c.
References GetCurrentTransactionNestLevel(), ActionList::nestingLevel, NotificationList::nestingLevel, pendingActions, pendingNotifies, pfree(), ActionList::upper, and NotificationList::upper.
Referenced by AbortSubTransaction().
Definition at line 1691 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().
Definition at line 2394 of file async.c.
References check_slru_buffers(), and newval.
Definition at line 2378 of file async.c.
References pendingActions, and pendingNotifies.
Referenced by AtAbort_Notify(), and AtCommit_Notify().
Definition at line 1136 of file async.c.
References IsListeningOn(), lappend(), listenChannels, MemoryContextSwitchTo(), pstrdup(), and TopMemoryContext.
Referenced by AtCommit_Notify().
Definition at line 1041 of file async.c.
References amRegisteredListener, Async_UnlistenOnExit(), asyncQueueReadAllNotifications(), before_shmem_exit(), DEBUG1, elog, i, INVALID_PROC_NUMBER, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyDatabaseId, MyProcNumber, 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().
Definition at line 1194 of file async.c.
References DEBUG1, elog, list_free_deep(), listenChannels, MyProcPid, NIL, and Trace_notify.
Referenced by Async_UnlistenOnExit(), and AtCommit_Notify().
Definition at line 1163 of file async.c.
References DEBUG1, elog, foreach_delete_current, lfirst, listenChannels, MyProcPid, pfree(), and Trace_notify.
Referenced by AtCommit_Notify().
Definition at line 1804 of file async.c.
References MyLatch, notifyInterruptPending, and SetLatch().
Referenced by procsignal_sigusr1_handler().
Definition at line 1212 of file async.c.
References lfirst, and listenChannels.
Referenced by asyncQueueProcessPageEntries(), and Exec_ListenCommit().
Definition at line 2348 of file async.c.
References Assert(), Notification::channel_len, Notification::data, DatumGetUInt32(), hash_any(), sort-test::key, and Notification::payload_len.
Referenced by AddEventToPendingNotifies().
Definition at line 2362 of file async.c.
References Assert(), Notification::channel_len, Notification::data, and Notification::payload_len.
Referenced by AddEventToPendingNotifies().
Definition at line 2224 of file async.c.
References buf, DestRemote, elog, INFO, pq_beginmessage(), pq_endmessage(), pq_sendint32(), pq_sendstring(), PqMsg_NotificationResponse, and whereToSendOutput.
Referenced by asyncQueueProcessPageEntries(), and ProcessParallelMessage().
Definition at line 790 of file async.c.
References FuncCallContext::call_cntr, CStringGetTextDatum, list_length(), list_nth(), listenChannels, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, and SRF_RETURN_NEXT.
Definition at line 1481 of file async.c.
References asyncQueueAdvanceTail(), asyncQueueUsage(), LW_SHARED, LWLockAcquire(), LWLockRelease(), PG_RETURN_FLOAT8, and usage().
Definition at line 557 of file async.c.
References Async_Notify(), PG_ARGISNULL, PG_GETARG_TEXT_PP, PG_RETURN_VOID, PreventCommandDuringRecovery(), and text_to_cstring().
Definition at line 861 of file async.c.
References AccessExclusiveLock, ListenAction::action, ActionList::actions, asyncQueueAddEntries(), asyncQueueFillWarning(), asyncQueueIsFull(), 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(), pendingActions, pendingNotifies, and Trace_notify.
Referenced by CommitTransaction().
Definition at line 2183 of file async.c.
References asyncQueueReadAllNotifications(), CommitTransactionCommand(), DEBUG1, elog, listenChannels, NIL, notifyInterruptPending, pq_flush, set_ps_display(), StartTransactionCommand(), and Trace_notify.
Referenced by ProcessNotifyInterrupt().
Definition at line 1834 of file async.c.
References IsTransactionOrTransactionBlock(), notifyInterruptPending, and ProcessIncomingNotify().
Referenced by PostgresMain(), and ProcessClientReadInterrupt().
Definition at line 690 of file async.c.
References generate_unaccent_rules::action, ListenAction::action, ActionList::actions, ListenAction::channel, CurTransactionContext, GetCurrentTransactionNestLevel(), lappend(), list_make1, MemoryContextAlloc(), MemoryContextSwitchTo(), ActionList::nestingLevel, palloc(), pendingActions, TopTransactionContext, and ActionList::upper.
Referenced by Async_Listen(), Async_Unlisten(), and Async_UnlistenAll().
Definition at line 1581 of file async.c.
References Assert(), asyncQueuePageDiff(), DEBUG3, elog, i, INVALID_PROC_NUMBER, InvalidPid, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaxBackends, MyDatabaseId, MyProcPid, notifyInterruptPending, 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 AtCommit_Notify().
Definition at line 419 of file async.c.
Referenced by asyncQueueUnregister(), AtAbort_Notify(), AtCommit_Notify(), and Exec_ListenPreCommit().
Definition at line 294 of file async.c.
Referenced by asyncQueueFillWarning(), and AsyncShmemInit().
Definition at line 320 of file async.c.
Referenced by asyncQueueUnregister(), AtAbort_Notify(), AtCommit_Notify(), Exec_ListenCommit(), Exec_UnlistenAllCommit(), Exec_UnlistenCommit(), IsListeningOn(), pg_listening_channels(), and ProcessIncomingNotify().
Definition at line 428 of file async.c.
Referenced by asyncQueueIsFull(), and asyncQueueUsage().
Definition at line 413 of file async.c.
Referenced by HandleNotifyInterrupt(), PostgresMain(), ProcessClientReadInterrupt(), ProcessIncomingNotify(), ProcessNotifyInterrupt(), and SignalBackends().
Definition at line 352 of file async.c.
Referenced by Async_Unlisten(), Async_UnlistenAll(), AtCommit_Notify(), AtPrepare_Notify(), AtSubAbort_Notify(), AtSubCommit_Notify(), ClearPendingActionsAndNotifies(), PreCommit_Notify(), and queue_listen().
Definition at line 404 of file async.c.
Referenced by AddEventToPendingNotifies(), Async_Notify(), AsyncExistsPendingNotify(), asyncQueueAddEntries(), AtCommit_Notify(), AtPrepare_Notify(), AtSubAbort_Notify(), AtSubCommit_Notify(), ClearPendingActionsAndNotifies(), and PreCommit_Notify().
Definition at line 425 of file async.c.
Referenced by Async_Listen(), Async_Notify(), Async_Unlisten(), Async_UnlistenAll(), AtCommit_Notify(), Exec_ListenPreCommit(), Exec_UnlistenAllCommit(), Exec_UnlistenCommit(), PreCommit_Notify(), and ProcessIncomingNotify().
Definition at line 422 of file async.c.
Referenced by asyncQueueAddEntries(), and AtCommit_Notify().
Definition at line 416 of file async.c.
Referenced by Async_Unlisten(), Async_UnlistenAll(), and Exec_ListenPreCommit().