mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
Resolve "kea-dhcp4 and 6: WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version."
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2229. [bug] tmark
|
||||||
|
Modified configure.ac to detect versions of MySQL
|
||||||
|
client libary for which MYSQL_OPT_RECONNECT is
|
||||||
|
deprecated and exclude from Kea core, code attempts
|
||||||
|
to set it false.
|
||||||
|
(Gitlab #3311)
|
||||||
|
|
||||||
Kea 2.5.8 (development) released on April 30, 2024
|
Kea 2.5.8 (development) released on April 30, 2024
|
||||||
|
|
||||||
2228. [build] piotrek
|
2228. [build] piotrek
|
||||||
|
10
configure.ac
10
configure.ac
@@ -790,6 +790,16 @@ $(cat conftest.cpp)
|
|||||||
$(cat conftest.err)])]
|
$(cat conftest.err)])]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Beginning with MySQL 8.0.34 MYSQL_OPT_RECONNNECT is deprecated.
|
||||||
|
# Check if MYSQL_OPT_RECONNNECT is defined.
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([#include <mysql.h>
|
||||||
|
auto temp = MYSQL_OPT_RECONNECT;]
|
||||||
|
[])],
|
||||||
|
[AC_MSG_RESULT([checking for MySQL MYSQL_OPT_RECONNNECT... yes])
|
||||||
|
AC_DEFINE([HAVE_MYSQL_OPT_RECONNECT], [1], [MySQL has MYSQL_OPT_RECONNNECT])],
|
||||||
|
[AC_MSG_RESULT([checking for MySQL MYSQL_OPT_RECONNECT... no])])
|
||||||
|
|
||||||
CPPFLAGS=$CPPFLAGS_SAVED
|
CPPFLAGS=$CPPFLAGS_SAVED
|
||||||
LIBS=$LIBS_SAVED
|
LIBS=$LIBS_SAVED
|
||||||
fi
|
fi
|
||||||
|
@@ -172,16 +172,20 @@ MySqlConnection::openDatabase() {
|
|||||||
|
|
||||||
// Set options for the connection:
|
// Set options for the connection:
|
||||||
//
|
//
|
||||||
// Set options for the connection:
|
int result;
|
||||||
// Make sure auto_reconnect is OFF! Enabling it leaves us with an unusable
|
#ifdef HAS_MYSQL_OPT_RECONNECT
|
||||||
|
// Though still supported by Mariadb (as of 11.5.0), MYSQL_OPT_RECONNECT is
|
||||||
|
// deprecated as of MySQL 8.0.34. Where it is still supported we should
|
||||||
|
// continue to ensure it is off. Enabling it leaves us with an unusable
|
||||||
// connection after a reconnect as among other things, it drops all our
|
// connection after a reconnect as among other things, it drops all our
|
||||||
// pre-compiled statements.
|
// pre-compiled statements.
|
||||||
my_bool auto_reconnect = MLM_FALSE;
|
my_bool auto_reconnect = MLM_FALSE;
|
||||||
int result = mysql_options(mysql_, MYSQL_OPT_RECONNECT, &auto_reconnect);
|
result = mysql_options(mysql_, MYSQL_OPT_RECONNECT, &auto_reconnect);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
isc_throw(DbOpenError, "unable to set auto-reconnect option: " <<
|
isc_throw(DbOpenError, "unable to set auto-reconnect option: " <<
|
||||||
mysql_error(mysql_));
|
mysql_error(mysql_));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Make sure we have a large idle time window ... say 30 days...
|
// Make sure we have a large idle time window ... say 30 days...
|
||||||
const char *wait_time = "SET SESSION wait_timeout = 30 * 86400";
|
const char *wait_time = "SET SESSION wait_timeout = 30 * 86400";
|
||||||
|
Reference in New Issue
Block a user