Commit 9881ef6d authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[master] Fixed sporadic segfault when using mysql backend

    Merges in 5354.
parents 18d31ca1 6b278a3f
......@@ -160,16 +160,25 @@ MySqlConnection::openDatabase() {
// Set options for the connection:
//
// Automatic reconnection: after a period of inactivity, the client will
// disconnect from the database. This option causes it to automatically
// reconnect when another operation is about to be done.
my_bool auto_reconnect = MLM_TRUE;
// Set options for the connection:
// Make sure auto_reconnect is OFF! Enabling it leaves us with an unusable
// connection after a reconnect as among other things, it drops all our
// pre-compiled statements.
my_bool auto_reconnect = MLM_FALSE;
int result = mysql_options(mysql_, MYSQL_OPT_RECONNECT, &auto_reconnect);
if (result != 0) {
isc_throw(DbOpenError, "unable to set auto-reconnect option: " <<
mysql_error(mysql_));
}
// Make sure we have a large idle time window ... say 30 days...
const char *wait_time = "SET SESSION wait_timeout = 30 * 86400";
result = mysql_options(mysql_, MYSQL_INIT_COMMAND, wait_time);
if (result != 0) {
isc_throw(DbOpenError, "unable to set wait_timeout " <<
mysql_error(mysql_));
}
// Set SQL mode options for the connection: SQL mode governs how what
// constitutes insertable data for a given column, and how to handle
// invalid data. We want to ensure we get the strictest behavior and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment