Bind 9.5.0 - Patch dlz MySQL 5 for auto reconnect

News Tips
September 4, 2007 | COMMENTS

Here is a quick post of a "quick and dirty" patch for the [ISC DNS][1] Server : Bind 9.5.0a6 and its dlz mysql driver. For the quick story, I was using [Bind][2] 9.4.1 with dlz MySQL. My [MySQL][3] server is a 5.0.41 (with [solidDB][4]). While using it, I realize that some times the dns server was returning empty value for the dns queries. I tried many tips but it was still (sometime) giving me empty answer... Of course, I suspected the dlz driver. So, I tried to upgrade to Bind 9.5.0a6 but the problem still happened and the only way to fix was to restart bind !

So I take a look at the dlz driver and make this simple patch for adding the following features:

  • Set option MYSQL_OPT_RECONNECT to 1
  • Add some log error information while doing a ping

In fact, after using the few logs added thru mysql ping, I discover that when the driver lost its connection to the mysql server (due to a small wait_timeout, mysql restart, etc.) it tried to ping but didn't succeed to reconnect to the server. Hopefully, I just needed to bypass the default option of MYSQL_OPT_RECONNECT while creating the connection.


Enable or disable automatic reconnection to the server if the connection is found to have been lost. Reconnect has been off by default since MySQL 5.0.3; this option is new in 5.0.13 and provides a way to set reconnection behavior explicitly.

Now, I don't have to run a bloody crontab for checking that my dns server is still answering to its dns queries.