Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitca5646f

Browse files
committed
Fix UNLISTEN to fall out quickly if the current backend has never executed
any LISTEN command. This is more important than it used to be becauseDISCARD ALL invokes UNLISTEN. Connection-pooled applications making heavyuse of DISCARD ALL were seeing significant contention for pg_listener,as reported by Matteo Beccati. It seems unlikely that clients using LISTENwould use pooled connections, so this simple tweak seems sufficient,especially since the pg_listener implementation is slated to go away soonanyway.Back-patch to 8.3, where DISCARD ALL was introduced.
1 parent30735ad commitca5646f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/backend/commands/async.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.145 2009/01/01 17:23:37 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.146 2009/02/13 17:12:04 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -277,6 +277,10 @@ Async_Unlisten(const char *relname)
277277
if (Trace_notify)
278278
elog(DEBUG1,"Async_Unlisten(%s,%d)",relname,MyProcPid);
279279

280+
/* If we couldn't possibly be listening, no need to queue anything */
281+
if (pendingActions==NIL&& !unlistenExitRegistered)
282+
return;
283+
280284
queue_listen(LISTEN_UNLISTEN,relname);
281285
}
282286

@@ -291,6 +295,10 @@ Async_UnlistenAll(void)
291295
if (Trace_notify)
292296
elog(DEBUG1,"Async_UnlistenAll(%d)",MyProcPid);
293297

298+
/* If we couldn't possibly be listening, no need to queue anything */
299+
if (pendingActions==NIL&& !unlistenExitRegistered)
300+
return;
301+
294302
queue_listen(LISTEN_UNLISTEN_ALL,"");
295303
}
296304

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp