* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.109 2004/02/08 22:28:56 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.110 2004/05/22 21:58:24 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* transaction, since by assumption it is only called from outside any
* transaction.
*
- * Although we grab AccessExclusiveLock on pg_listener for any operation,
+ * Although we grab ExclusiveLock on pg_listener for any operation,
* the lock is never held very long, so it shouldn't cause too much of
- * a performance problem.
+ * a performance problem. (Previously we used AccessExclusiveLock, but
+ * there's no real reason to forbid concurrent reads.)
*
* An application that listens on the same relname it notifies will get
* NOTIFY messages for its own NOTIFYs. These can be ignored, if not useful,
if (Trace_notify)
elog(DEBUG1, "Async_Listen(%s,%d)", relname, pid);
- lRel = heap_openr(ListenerRelationName, AccessExclusiveLock);
+ lRel = heap_openr(ListenerRelationName, ExclusiveLock);
/* Detect whether we are already listening on this relname */
scan = heap_beginscan(lRel, SnapshotNow, 0, NULL);
if (alreadyListener)
{
- heap_close(lRel, AccessExclusiveLock);
+ heap_close(lRel, ExclusiveLock);
return;
}
heap_freetuple(tuple);
- heap_close(lRel, AccessExclusiveLock);
+ heap_close(lRel, ExclusiveLock);
/*
* now that we are listening, make sure we will unlisten before dying.
if (Trace_notify)
elog(DEBUG1, "Async_Unlisten(%s,%d)", relname, pid);
- lRel = heap_openr(ListenerRelationName, AccessExclusiveLock);
+ lRel = heap_openr(ListenerRelationName, ExclusiveLock);
scan = heap_beginscan(lRel, SnapshotNow, 0, NULL);
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
}
heap_endscan(scan);
- heap_close(lRel, AccessExclusiveLock);
+ heap_close(lRel, ExclusiveLock);
/*
* We do not complain about unlistening something not being listened;
if (Trace_notify)
elog(DEBUG1, "Async_UnlistenAll");
- lRel = heap_openr(ListenerRelationName, AccessExclusiveLock);
+ lRel = heap_openr(ListenerRelationName, ExclusiveLock);
tdesc = RelationGetDescr(lRel);
/* Find and delete all entries with my listenerPID */
simple_heap_delete(lRel, &lTuple->t_self);
heap_endscan(scan);
- heap_close(lRel, AccessExclusiveLock);
+ heap_close(lRel, ExclusiveLock);
}
/*
value[0] = value[1] = value[2] = (Datum) 0;
value[Anum_pg_listener_notify - 1] = Int32GetDatum(MyProcPid);
- lRel = heap_openr(ListenerRelationName, AccessExclusiveLock);
+ lRel = heap_openr(ListenerRelationName, ExclusiveLock);
tdesc = RelationGetDescr(lRel);
scan = heap_beginscan(lRel, SnapshotNow, 0, NULL);
StartTransactionCommand();
- lRel = heap_openr(ListenerRelationName, AccessExclusiveLock);
+ lRel = heap_openr(ListenerRelationName, ExclusiveLock);
tdesc = RelationGetDescr(lRel);
/* Scan only entries with my listenerPID */