Hi. I don't know if this mail is a feature request a bug report or none,
so I'll just tell you what do I see.

I'm doing a program that requires some grade of high availability, so I
need to detect when a database is down to connect to another one (I'm
using Slony to do the replication, in case somebody cares =).

1) The first problem I found is that when I stop the postgresql server
muy program receives a SIGPIPE when doing, for example, a
transaction.exec(). I was expecting an exception.

2) Another thing I don't like is a message is written to the standard
output ("FATAL: terminating connection due to administrator command"),
even when I'm a good boy and handle the SIGPIPE signal =). This is
really not that important but I think it's not a good thing for a
library to print messages to the standard output when you have the error
codes to do whatever you feel is better to handle the error.

3) When the connection is lost because a network problem, the libpqxx
methods (like transaction.exec()) keeps waiting way too long for the
connection to be reestablished and then fails after a long time with
SIGPIPE again (but without the "FATAL" error message).

I know none of this problems are really from libpqxx: 1) is because
libpq don't use MSG_NOSIGNAL flag when send()ing or recv()ing data with
the socket (I know this is probably a feature, not a bug, but I think it
would be great and much more C++-friendly if you could raise an
exception instead of catching a singal). 2) is again libpq's fault, but
is there any way to tell libpq to be quiet? and 3) I guess is just TCP's
fault to be so badass and wait that long, but what about a keep-alive +
TTL to try to figure out when the connection is lost in a shorter time
(like the "connect_timeout" parameter in the connection string, which
works only when connecting, but not when doing a query for example).

I'm open to suggestions, both workarrounds for my code and enhancements
to libpqxx/libpq.

TIA.

-- 
Leandro Lucarella
Integratech S.A.
4571-5252

_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to