Skip to content

Commit 6d6e441

Browse files
committed
Avoid catalog read via superuser() call in DecrementSharedConnectionCounter
1 parent 51a43dc commit 6d6e441

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/distributed/connection/shared_connection_stats.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ IncrementSharedConnectionCounter(const char *hostname, int port)
420420
{
421421
SharedConnStatsHashKey connKey;
422422

423-
if (GetMaxSharedPoolSize() == DISABLE_CONNECTION_THROTTLING)
423+
if (MaxSharedPoolSize == DISABLE_CONNECTION_THROTTLING)
424424
{
425425
/* connection throttling disabled */
426426
return;
@@ -484,7 +484,11 @@ DecrementSharedConnectionCounter(const char *hostname, int port)
484484
{
485485
SharedConnStatsHashKey connKey;
486486

487-
if (GetMaxSharedPoolSize() == DISABLE_CONNECTION_THROTTLING)
487+
/*
488+
* Do not call GetMaxSharedPoolSize() here, since it may read from
489+
* the catalog and we may be in the process exit handler.
490+
*/
491+
if (MaxSharedPoolSize == DISABLE_CONNECTION_THROTTLING)
488492
{
489493
/* connection throttling disabled */
490494
return;

0 commit comments

Comments
 (0)