> -----Original Message----- > From: Norbert Sendetzky [mailto:norb...@linuxnetworks.de] > Sent: Tuesday, January 25, 2011 3:01 PM > To: OpenDBX devel list > Subject: Re: [opendbx] FW: [BUGS] BUG #5837: PQstatus() fails to report lost > connection > > If I understood your explanation right, we have a third possibility if > we manage to return a fatal error when calling odbx_error_type() after > we got PGRES_FATAL_ERROR from PGgetResultStatus() in odbx_result(). In > this case we shouldn't care about what PQstatus() is saying as it > doesn't know what's going on. > > What do you think?
I thought of that too. The only concern there is that you might insist on a restart (odbx_error_type() returning -1) when it's not actually needed, because unfortunately PGgetResultStatus() can report a fatal error when the connection is intact but the transaction was fatal; there's no way to distinguish the two. So while this would certainly work to make the result more reliable, it would also mean a degradation in performance because of potentially unnecessary reconnections. In OpenDKIM what I've actually done is to add a compile-time flag that will extract the error string when odbx_result() returns -1; if the string says "FATAL:" in it, then I pretend odbx_error_type() returned -1 and arrange for a reconnect. That way, I hope, I avoid reconnects when the query was fatal but the connection is fine, and otherwise provide reasonably reliable service. That way the user can decide, for now, whether to use libpq as defined (broken, IMHO) or try to work around it with some possibility for penalty. -MSK ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ libopendbx-devel mailing list libopendbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libopendbx-devel http://www.linuxnetworks.de/doc/index.php/OpenDBX