diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-02-16 22:34:57 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-02-16 22:34:57 +0000 |
commit | d1e027221d0243b7b57eabb0e482923dd7d1c8eb (patch) | |
tree | 034988b788248c88fad3b73fb4d8d1afff2dd509 /src/include/commands/async.h | |
parent | fc5173ad514a216dc93bc190dbba3751024a257d (diff) | |
download | postgresql-d1e027221d0243b7b57eabb0e482923dd7d1c8eb.tar.gz postgresql-d1e027221d0243b7b57eabb0e482923dd7d1c8eb.zip |
Replace the pg_listener-based LISTEN/NOTIFY mechanism with an in-memory queue.
In addition, add support for a "payload" string to be passed along with
each notify event.
This implementation should be significantly more efficient than the old one,
and is also more compatible with Hot Standby usage. There is not yet any
facility for HS slaves to receive notifications generated on the master,
although such a thing is possible in future.
Joachim Wieland, reviewed by Jeff Davis; also hacked on by me.
Diffstat (limited to 'src/include/commands/async.h')
-rw-r--r-- | src/include/commands/async.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/include/commands/async.h b/src/include/commands/async.h index 5c9e8ab8906..a9e4d42853d 100644 --- a/src/include/commands/async.h +++ b/src/include/commands/async.h @@ -6,28 +6,44 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/async.h,v 1.39 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/async.h,v 1.40 2010/02/16 22:34:57 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef ASYNC_H #define ASYNC_H +#include "fmgr.h" + +/* + * The number of SLRU page buffers we use for the notification queue. + */ +#define NUM_ASYNC_BUFFERS 8 + extern bool Trace_notify; +extern Size AsyncShmemSize(void); +extern void AsyncShmemInit(void); + /* notify-related SQL statements */ -extern void Async_Notify(const char *relname); -extern void Async_Listen(const char *relname); -extern void Async_Unlisten(const char *relname); +extern void Async_Notify(const char *channel, const char *payload); +extern void Async_Listen(const char *channel); +extern void Async_Unlisten(const char *channel); extern void Async_UnlistenAll(void); +/* notify-related SQL functions */ +extern Datum pg_listening_channels(PG_FUNCTION_ARGS); +extern Datum pg_notify(PG_FUNCTION_ARGS); + /* perform (or cancel) outbound notify processing at transaction commit */ +extern void PreCommit_Notify(void); extern void AtCommit_Notify(void); extern void AtAbort_Notify(void); extern void AtSubStart_Notify(void); extern void AtSubCommit_Notify(void); extern void AtSubAbort_Notify(void); extern void AtPrepare_Notify(void); +extern void ProcessCompletedNotifies(void); /* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */ extern void HandleNotifyInterrupt(void); @@ -40,7 +56,4 @@ extern void HandleNotifyInterrupt(void); extern void EnableNotifyInterrupt(void); extern bool DisableNotifyInterrupt(void); -extern void notify_twophase_postcommit(TransactionId xid, uint16 info, - void *recdata, uint32 len); - #endif /* ASYNC_H */ |