Hi,
Nicolas Baradakis, 2005-07-05:
>
>
> The options MYSQL_OPT_READ_TIMEOUT and MYSQL_OPT_WRITE_TIMEOUT have
> been added to the mysql_options() function in version 4.1.1 of the
> libmysqlclient. However, for now they're available for windows only.
>
> I think a timeout is very useful for a program using the MySQL client
> library. It prevents the application from hanging on an I/O operation
> when the MySQL server does not respond (heavy load, hardware problem,
> etc.) That's why I tried to make timeout options available on systems
> other than windows.
Indeed, this is very useful for highly available Postfix deployments
with multiple, read-only MySQL servers at the backend. The fact that
some portions of Postfix are single-threaded (for instance the queue
manager doing transport MySQL table lookups) means that the mail system
can deadlock when such query hangs for too long, not mentioning the
fact that high query latency on this part of the system means low mail
system throughput ...
> Following patch was made against the latest nightly snapshot available
> on dev.mysql.com. It works on Linux, and should work on other POSIX
> systems. [...]
IIRC these socket options (i.e. SO_SNDTIMEO, SO_RCVTIMEO) are not
available in Linux <= 2.2, so not every deployment could actually
use this feature.
Perhaps the patch could be modified so that network timeouts are
detected using read and write-select operations when the operating
system doesn't support such sockopts? This is IMHO a more portable
approach.
Leandro.