Skip to content

Commit

Permalink
Also retry libpq connections to a local host. (#793)
Browse files Browse the repository at this point in the history
As seen in the field, we might have a transient problem when trying to
connect to a local Postgres instance, even when using Unix Domain Sockets.
  • Loading branch information
DimCitus committed Sep 2, 2021
1 parent 16652af commit 329b554
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/bin/pg_autoctl/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,17 +521,10 @@ pgsql_open_connection(PGSQL *pgsql)
/*
* Implement the retry policy:
*
* - for a local Postgres node, we always expect to be able to connect
* and defer managing this at the Postgres Controller level, so we
* never retry.
*
* - for MONITOR or COORDINATOR (remote) connections, we may have a
* specific policy to follow. In any case we observe first the maxR
* property: maximum retries allowed. When set to zero, we don't
* retry at all.
* First observe the maxR property: maximum retries allowed. When set
* to zero, we don't retry at all.
*/
if (pgsql->connectionType == PGSQL_CONN_LOCAL ||
pgsql->retryPolicy.maxR == 0)
if (pgsql->retryPolicy.maxR == 0)
{
INSTR_TIME_SET_CURRENT(pgsql->retryPolicy.connectTime);

Expand Down

0 comments on commit 329b554

Please sign in to comment.