mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
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.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.332 2010/02/14 18:42:15 rhaas Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.333 2010/02/16 22:34:50 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -926,17 +926,17 @@ standard_ProcessUtility(Node *parsetree,
|
||||
case T_NotifyStmt:
|
||||
{
|
||||
NotifyStmt *stmt = (NotifyStmt *) parsetree;
|
||||
PreventCommandDuringRecovery();
|
||||
|
||||
Async_Notify(stmt->conditionname);
|
||||
PreventCommandDuringRecovery();
|
||||
Async_Notify(stmt->conditionname, stmt->payload);
|
||||
}
|
||||
break;
|
||||
|
||||
case T_ListenStmt:
|
||||
{
|
||||
ListenStmt *stmt = (ListenStmt *) parsetree;
|
||||
PreventCommandDuringRecovery();
|
||||
|
||||
PreventCommandDuringRecovery();
|
||||
CheckRestrictedOperation("LISTEN");
|
||||
Async_Listen(stmt->conditionname);
|
||||
}
|
||||
@ -945,8 +945,8 @@ standard_ProcessUtility(Node *parsetree,
|
||||
case T_UnlistenStmt:
|
||||
{
|
||||
UnlistenStmt *stmt = (UnlistenStmt *) parsetree;
|
||||
PreventCommandDuringRecovery();
|
||||
|
||||
PreventCommandDuringRecovery();
|
||||
CheckRestrictedOperation("UNLISTEN");
|
||||
if (stmt->conditionname)
|
||||
Async_Unlisten(stmt->conditionname);
|
||||
@ -1105,8 +1105,8 @@ standard_ProcessUtility(Node *parsetree,
|
||||
case T_ReindexStmt:
|
||||
{
|
||||
ReindexStmt *stmt = (ReindexStmt *) parsetree;
|
||||
PreventCommandDuringRecovery();
|
||||
|
||||
PreventCommandDuringRecovery();
|
||||
switch (stmt->kind)
|
||||
{
|
||||
case OBJECT_INDEX:
|
||||
|
Reference in New Issue
Block a user