2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 22:15:23 +00:00

[5477] dhcpsrv/postgres and kea-dhcp4 now support db reconnect

kea-dhcp4
    added support for max-reconnect-tries and reconnect-wait-time
    to lease and host db parsers

    Added a callback for when DB backends detect loss of connectivity

    Added a self-rescheduling method to attempt to reconnect to the
    backends if retries are enabled

dhcpsrv
    Added a callback that DatabaseConnection derivations should invoke
    when they lose connectivity.

    Added an optional callback parameter from CfgDbAccess::createManagers()
    all the way down to DatabaseConnection ctor.

    pgsql_connection.cc
        PgSqlConnection::~PgSqlConnection() - Added logic to close the
        connection only when the connect state is still OK.
        Otherwise it likes to core dump.

        PgSqlConnection::checkStatementError() - Modified to invoke the
        connectivity lost callback on "fatal" errors

    pgsql_lease_mgr_unittest.cc
    pgsql_host_data_source_unittest.cc
        Added tests to verify that the lost callback is NOT invoked on an
        open failure
This commit is contained in:
Thomas Markwalder
2018-02-28 15:29:23 -05:00
parent f124d85d24
commit 249219f1fc
34 changed files with 3645 additions and 3318 deletions

View File

@@ -53,11 +53,15 @@ public:
/// @param parameters A data structure relating keywords and values
/// concerned with the database.
///
/// @param db_lost_callback function to invoke if connectivity to
/// to host database is lost.
///
/// @throw isc::dhcp::NoDatabaseName Mandatory database name not given
/// @throw isc::dhcp::DbOpenError Error opening the database
/// @throw isc::dhcp::DbOperationError An operation on the open database has
/// failed.
PgSqlHostDataSource(const DatabaseConnection::ParameterMap& parameters);
PgSqlHostDataSource(const DatabaseConnection::ParameterMap& parameters,
DatabaseConnection::Callback db_lost_callback = NULL);
/// @brief Virtual destructor.
/// Frees database resources and closes the database connection through