forked from ged/ruby-pg
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert connecting on a host-by-host basis
.. in favor of passing all hosts to libpq at once and instead adjust connect_timeout handling roughtly to how libpq handles it. The problem is that libpg aborts connecting to multiple hosts, if there's a authentication failure. But if pg imitates this behaviour, the libpq API doesn't give an exact indication, whether the connection aborted due to an authentication error or due to some other error, which continues the host iteration. So we can not distinguish between an authentication error and other types of errors, other then by the error message. But there's the next problem, that the error message is locale dependent and that when both client and server are running on Windows, the error message is often not correctly delivered, which is a known long standing PostgreSQL issue. This commit therefore changes the execution back to how multiple hosts were handled similar to pg-1.3.x, but with two fixes: 1. Multiple IP addresses to one hostname are handled correctly, (fixes ged#452) 2. and connect_timeout is handled roughly like libpq. (fixes ged#450) It's only roughly, since the timeout is not strictly per host, but per single socket event, but with a total timeout multiplied with the number-of-hosts. Exact handling of connect_timeout like libpq is only possible if we connect host-by-host.
- Loading branch information
Showing
3 changed files
with
25 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters