]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1375] added more comments
authorRazvan Becheriu <razvan@isc.org>
Fri, 13 Nov 2020 09:54:26 +0000 (11:54 +0200)
committerRazvan Becheriu <razvan@isc.org>
Wed, 9 Dec 2020 17:12:46 +0000 (19:12 +0200)
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc
src/lib/config_backend/base_config_backend.h
src/lib/config_backend/base_config_backend_mgr.h
src/lib/config_backend/base_config_backend_pool.h
src/lib/database/database_connection.h
src/lib/dhcpsrv/mysql_host_data_source.cc
src/lib/dhcpsrv/pgsql_lease_mgr.cc

index f15d28922d1a5325456aede2debb3ff803a9f16e..1225a85dc7e317a4b758ca90e2ad3db37ae45444 100644 (file)
@@ -2296,6 +2296,25 @@ public:
         return (count);
     }
 
+    /// @brief Attempts to reconnect the server to the config DB backend manager.
+    ///
+    /// This is a self-rescheduling function that attempts to reconnect to the
+    /// server's host DB backends after connectivity to one or more have been
+    /// lost. Upon entry it will attempt to reconnect via
+    /// @ref ConfigBackendDHCPv4Mgr.addBackend.
+    /// If this is successful, DHCP servicing is re-enabled and server returns
+    /// to normal operation.
+    ///
+    /// If reconnection fails and the maximum number of retries has not been
+    /// exhausted, it will schedule a call to itself to occur at the
+    /// configured retry interval. DHCP service remains disabled.
+    ///
+    /// If the maximum number of retries has been exhausted an error is logged
+    /// and the server shuts down.
+    ///
+    /// @param db_reconnect_ctl pointer to the ReconnectCtl containing the
+    /// configured reconnect parameters.
+    /// @return true if connection has been recovered, false otherwise.
     static bool dbReconnect(ReconnectCtlPtr db_reconnect_ctl) {
         DatabaseConnection::invokeDbLostCallback(db_reconnect_ctl);
 
index 3f8f5ea6e96019838e0fb8063ab53859bb4c6b26..bc8ed45342cc6e9f660dd53b41eaa08d325b8651 100644 (file)
@@ -2739,6 +2739,25 @@ public:
         return (count);
     }
 
+    /// @brief Attempts to reconnect the server to the config DB backend manager.
+    ///
+    /// This is a self-rescheduling function that attempts to reconnect to the
+    /// server's host DB backends after connectivity to one or more have been
+    /// lost. Upon entry it will attempt to reconnect via
+    /// @ref ConfigBackendDHCPv6Mgr.addBackend.
+    /// If this is successful, DHCP servicing is re-enabled and server returns
+    /// to normal operation.
+    ///
+    /// If reconnection fails and the maximum number of retries has not been
+    /// exhausted, it will schedule a call to itself to occur at the
+    /// configured retry interval. DHCP service remains disabled.
+    ///
+    /// If the maximum number of retries has been exhausted an error is logged
+    /// and the server shuts down.
+    ///
+    /// @param db_reconnect_ctl pointer to the ReconnectCtl containing the
+    /// configured reconnect parameters.
+    /// @return true if connection has been recovered, false otherwise.
     static bool dbReconnect(ReconnectCtlPtr db_reconnect_ctl) {
         DatabaseConnection::invokeDbLostCallback(db_reconnect_ctl);
 
index ad9da62be8b0f99c37e1c3a80244aaed864ea7b0..fb6f8ab6c1b72e1f5e0f5875ea5fac4a1aa95ff9 100644 (file)
@@ -63,14 +63,14 @@ public:
     /// connection.
     ///
     /// @return true if there is at least one unusable connection, false
-    /// otherwise
+    /// otherwise.
     virtual bool isUnusable() {
         return (false);
     }
 
-    /// @brief Return backend parameters
+    /// @brief Return backend parameters.
     ///
-    /// Returns the backend parameters
+    /// Returns the backend parameters.
     ///
     /// @return Parameters of the backend.
     virtual isc::db::DatabaseConnection::ParameterMap getParameters() const {
index 8f3efd25bf7ac50db7bd0cbe35ec008775ef4df4..6818effefbb441a3ecc0a8d3d2ce6392c8fd85c9 100644 (file)
@@ -188,7 +188,7 @@ public:
     /// specific parameters.
     /// This should have the effect of closing the database connection.
     ///
-    /// @param db_type Backend to remove
+    /// @param db_type Backend to remove.
     /// @param dbaccess Database access string being a collection of
     /// key=value pairs.
     /// @param if_unusable Flag which indicates if the config backend manager
index 01347476a0c47e9bc544c973e8487e88183051df..fab02171bcf13c2ec75c5b1ee2582afa18b8b0b0 100644 (file)
@@ -64,7 +64,7 @@ public:
 
     /// @brief Deletes all backends of the given type from the pool.
     ///
-    /// @param db_type Backend to remove
+    /// @param db_type Backend to remove.
     void delAllBackends(const std::string& db_type) {
         typename std::list<ConfigBackendTypePtr>::iterator backend = backends_.begin();
 
@@ -79,7 +79,7 @@ public:
 
     /// @brief Deletes all backends of the given type from the pool.
     ///
-    /// @param db_type Backend to remove
+    /// @param db_type Backend to remove.
     /// @param dbaccess Database access string being a collection of
     /// key=value pairs.
     /// @param if_unusable Flag which indicates if the config backend manager
index 301f3a1378837554ef700dd9548c4bad9c85b0c9..0910a5a464e66743369dc3c2014a89ad0aee6192 100644 (file)
@@ -201,7 +201,7 @@ public:
 
     /// @brief The reconnect settings.
     ///
-    /// @brief return The reconnect settings.
+    /// @return The reconnect settings.
     ReconnectCtlPtr reconnectCtl() {
         return (reconnect_ctl_);
     }
index 8677d743245d5cb30c3b5d039c0d3458600e5fae..90d16cd28b3c92633b4cefc359d0f8a7c860fbca 100644 (file)
@@ -2775,6 +2775,10 @@ MySqlHostDataSourceImpl::MySqlHostDataSourceImpl(const DatabaseConnection::Param
     : parameters_(parameters), ip_reservations_unique_(true), unusable_(false),
       timer_name_("") {
 
+    timer_name_ = "MySqlHostMgr[";
+    timer_name_ += boost::lexical_cast<std::string>(reinterpret_cast<uint64_t>(this));
+    timer_name_ += "]DbReconnectTimer";
+
     // Validate the schema version first.
     std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR,
                                                MYSQL_SCHEMA_VERSION_MINOR);
@@ -2793,10 +2797,6 @@ MySqlHostDataSourceImpl::MySqlHostDataSourceImpl(const DatabaseConnection::Param
 
     auto db_reconnect_ctl = pool_->pool_[0]->conn_.reconnectCtl();
 
-    timer_name_ = "MySqlHostMgr[";
-    timer_name_ += boost::lexical_cast<std::string>(reinterpret_cast<uint64_t>(this));
-    timer_name_ += "]DbReconnectTimer";
-
     TimerMgr::instance()->registerTimer(timer_name_,
         std::bind(&MySqlHostDataSourceImpl::dbReconnect, db_reconnect_ctl),
                   db_reconnect_ctl->retryInterval(),
index cd98224a98beb2a8a3a712db83acd536861c1fc1..8687980ccde185df1f2ed9447db1d9dc115e98fc 100644 (file)
@@ -1261,7 +1261,7 @@ PgSqlLeaseMgr::dbReconnect(ReconnectCtlPtr db_reconnect_ctl) {
     try {
         CfgDbAccessPtr cfg_db = CfgMgr::instance().getCurrentCfg()->getCfgDbAccess();
         LeaseMgrFactory::destroy();
-        LeaseMgrFactory::create(cfg_db->getLeaseDbAccessString()/*, io_service_ */);
+        LeaseMgrFactory::create(cfg_db->getLeaseDbAccessString());
 
         reopened = true;
     } catch (const std::exception& ex) {