Skip to content

Commit

Permalink
Avoid catalog read via superuser() call in DecrementSharedConnectionC…
Browse files Browse the repository at this point in the history
…ounter
  • Loading branch information
marcoslot committed Jul 29, 2022
1 parent 51a43dc commit 6d6e441
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/backend/distributed/connection/shared_connection_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ IncrementSharedConnectionCounter(const char *hostname, int port)
{
SharedConnStatsHashKey connKey;

if (GetMaxSharedPoolSize() == DISABLE_CONNECTION_THROTTLING)
if (MaxSharedPoolSize == DISABLE_CONNECTION_THROTTLING)
{
/* connection throttling disabled */
return;
Expand Down Expand Up @@ -484,7 +484,11 @@ DecrementSharedConnectionCounter(const char *hostname, int port)
{
SharedConnStatsHashKey connKey;

if (GetMaxSharedPoolSize() == DISABLE_CONNECTION_THROTTLING)
/*
* Do not call GetMaxSharedPoolSize() here, since it may read from
* the catalog and we may be in the process exit handler.
*/
if (MaxSharedPoolSize == DISABLE_CONNECTION_THROTTLING)
{
/* connection throttling disabled */
return;
Expand Down

0 comments on commit 6d6e441

Please sign in to comment.