Bind 9.5.0 - Patch dlz MySQL 5 for Auto Reconnect

  • HOME
  • >
  • LINUX
  • >
  • Bind 9.5.0 - Patch dlz MySQL 5 for Auto Reconnect
Last Updated: 

👉 This post was initially written in 2007 and refered to specific software versions. When troubleshooting your system, always consider which version and environment you are using.

This post cover a patch for the ISC DNS Server Bind version 9.5.0a6 and its dlz MySQL driver. For the quick story, I was using Bind 9.4.1 with the dlz MySQL driver. This allowed me to manage DNS records directly in MySQL. The MySQL server was a 5.0.41 with solidDB. While using it, I found out that some times the dns server was returning empty values for the dns queries. As I suspected the dlz driver but couldn't get to the bottom of the issue, I decided to upgrade to Bind 9.5.0a6 in a hope to get latest fixes but the problem still occured and the only way to fix was to restart bind on a regular basis. Not good!

To solve the issue, I had to go a bit deeper and take a look at the dlz driver source code which lead me to produce this simple patch to add the following features:

  • Set option MYSQL_OPT_RECONNECT to 1
  • Add Error Logs messages while doing a MySQL ping

After using the few logs added thru a mysql ping, I discovered 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. This is what lead me to adding the MYSQL_OPT_RECONNECT option while creating the connection in the driver.

MYSQL_OPT_RECONNECT

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.

This patch was applied to the Gentoo net-dns/bind package in 2008, see repo/gentoo/historical.git and Bug #180720

Related linux posts that you may like
What are the Differences Between Vi and Vim?
Review of the main differences between the Vi/Ex POSIX standard and the Vim implementation.
sudo: no tty present and no askpass program specified
Learn what is askpass and how to solve the 'sudo: no tty present and no askpass program specified' error when using sudo to execute a command.
What is the Bash Null Command?
Learn about the Bash null command, also known as the POSIX shell colon command. This post cover concrete use cases and pitfalls to avoid.