Add missing connection close

In a corner-case situation where a standby is unable to attach to
the new primary due to a mismatch in the WAL stream, the connection
used to verify the recovery status of the new primary was not being
closed, leading to a risk of connection exhaustion on the new primary.

Addresses GitHub #682.
This commit is contained in:
Ian Barwick
2020-12-01 16:08:05 +09:00
parent 21f94e6de3
commit 9d2c5921ee

View File

@@ -3921,6 +3921,7 @@ follow_new_primary(int new_primary_id)
termPQExpBuffer(&event_details);
close_connection(&upstream_conn);
close_connection(&old_primary_conn);
return FAILOVER_STATE_PRIMARY_REAPPEARED;
@@ -3931,6 +3932,8 @@ follow_new_primary(int new_primary_id)
close_connection(&old_primary_conn);
}
close_connection(&upstream_conn);
return FAILOVER_STATE_FOLLOW_FAIL;
}