2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[5556a] MySQL lease and host backends now support configurable auto-reconnect

src/lib/dhcpsrv/mysql_connection.h
        MySqlConnection::checkError<>() - modified to invoke
        db lost callback

    src/lib/dhcpsrv/dhcpsrv_messages.mes
        Updated log messages

    src/lib/dhcpsrv/mysql_lease_mgr.cc
        MySqlLeaseMgr::getVersion() - updated to use checkError()

    src/lib/dhcpsrv/pgsql_connection.*
        PgSqlResult::PgSqlResult(PGresult *result) - now supports
        construction with null PGresult. This is to accomodate rare
        cases when PQ* statements can return NULL.

    src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.*
        class LeaseMgrDbLostCallbackTest - new test fixture for
        testing LeaseMgr DBLostCallback behavior

    src/lib/dhcpsrv/tests/host_mgr_unittest.cc
        class HostMgrDbLostCallbackTest
        class MySQLHostMgrDbLostCallbackTest
        class PostgreSQLHostMgrDbLostCallbackTest
        - new test fixtures for testing HostMgr DBLostCallback behavior

    src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
        class MySQLLeaseMgrDbLostCallbackTest - new test fixture for
        testing MySQL LeaseMgr DBLostCallback behavior

    src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc
        class PgSqlLeaseMgrDbLostCallbackTest - new test fixture for
        testing Postgresql LeaseMgr DBLostCallback behavior

    src/lib/dhcpsrv/tests/test_utils.*
        int findLastSocketFd() - new function used for finding what
        should be the fd of the SQL client socket

    doc/guide/dhcp4-srv.xml
    doc/guide/dhcp6-srv.xml
        Updated lease and host database parameter sections
This commit is contained in:
Thomas Markwalder
2018-04-06 15:16:24 -04:00
parent 3c22fedef7
commit f09bf17e2e
17 changed files with 510 additions and 88 deletions

View File

@@ -2240,11 +2240,7 @@ MySqlLeaseMgr::getVersion() const {
// Execute the prepared statement
int status = mysql_stmt_execute(conn_.statements_[stindex]);
if (status != 0) {
isc_throw(DbOperationError, "unable to execute <"
<< conn_.text_statements_[stindex] << "> - reason: " <<
mysql_error(conn_.mysql_));
}
checkError(status, stindex, "unable to execute statement");
// Bind the output of the statement to the appropriate variables.
MYSQL_BIND bind[2];
@@ -2261,19 +2257,13 @@ MySqlLeaseMgr::getVersion() const {
bind[1].buffer_length = sizeof(minor);
status = mysql_stmt_bind_result(conn_.statements_[stindex], bind);
if (status != 0) {
isc_throw(DbOperationError, "unable to bind result set: " <<
mysql_error(conn_.mysql_));
}
checkError(status, stindex, "unable to bind result set");
// Fetch the data and set up the "release" object to release associated
// resources when this method exits then retrieve the data.
MySqlFreeResult fetch_release(conn_.statements_[stindex]);
status = mysql_stmt_fetch(conn_.statements_[stindex]);
if (status != 0) {
isc_throw(DbOperationError, "unable to obtain result set: " <<
mysql_error(conn_.mysql_));
}
checkError(status, stindex, "unable to fetch result set");
return (std::make_pair(major, minor));
}