]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3019] addressed review comments
authorRazvan Becheriu <razvan@isc.org>
Wed, 13 Dec 2023 16:15:49 +0000 (18:15 +0200)
committerRazvan Becheriu <razvan@isc.org>
Thu, 14 Dec 2023 06:01:42 +0000 (08:01 +0200)
15 files changed:
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
doc/sphinx/arm/hooks-legal-log.rst
src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc
src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/mysql_host_data_source.cc
src/lib/dhcpsrv/mysql_host_data_source.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_host_data_source.cc
src/lib/dhcpsrv/pgsql_host_data_source.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/testutils/generic_cb_recovery_unittest.cc

index 4cd536b9155c30c5461a0546e7d2eb848b4e033e..307c488cfefea7637c767b41b60557babc1fdbd2 100644 (file)
@@ -583,13 +583,13 @@ The possible values are:
    "Dhcp4": { "lease-database": { "retry-on-startup" : true, ... }, ... }
 
 During server startup, the inability to connect to any of the configured
-backends is considered fatal only if ``retry-on-startup`` is set to ``false``.
-A fatal error is logged and the server exits, based on the idea that the
-configuration should be valid at startup. Exiting to the operating system allows
-nanny scripts to detect the problem.
+backends is considered fatal only if ``retry-on-startup`` is set to ``false``
+(the default). A fatal error is logged and the server exits, based on the idea
+that the configuration should be valid at startup. Exiting to the operating
+system allows nanny scripts to detect the problem.
 If ``retry-on-startup`` is set to ``true``, the server will start reconnection
 attempts even at server startup or on reconfigure events, and will honor the
-action specified in ``on-fail`` parameter.
+action specified in the ``on-fail`` parameter.
 
 The host parameter is used by the MySQL and PostgreSQL backends.
 
@@ -818,13 +818,13 @@ The possible values are:
    "Dhcp4": { "hosts-database": { "retry-on-startup" : true, ... }, ... }
 
 During server startup, the inability to connect to any of the configured
-backends is considered fatal only if ``retry-on-startup`` is set to ``false``.
-A fatal error is logged and the server exits, based on the idea that the
-configuration should be valid at startup. Exiting to the operating system allows
-nanny scripts to detect the problem.
+backends is considered fatal only if ``retry-on-startup`` is set to ``false``
+(the default). A fatal error is logged and the server exits, based on the idea
+that the configuration should be valid at startup. Exiting to the operating
+system allows nanny scripts to detect the problem.
 If ``retry-on-startup`` is set to ``true``, the server will start reconnection
 attempts even at server startup or on reconfigure events, and will honor the
-action specified in ``on-fail`` parameter.
+action specified in the ``on-fail`` parameter.
 
 Finally, the credentials of the account under which the server will
 access the database should be set:
index 93ba23774a8d356a3e61b89eb43d723c4c23dfb5..9c19b1460d78773fee270f154155bbb99a37fcef 100644 (file)
@@ -539,13 +539,13 @@ The possible values are:
    "Dhcp6": { "lease-database": { "retry-on-startup" : true, ... }, ... }
 
 During server startup, the inability to connect to any of the configured
-backends is considered fatal only if ``retry-on-startup`` is set to ``false``.
-A fatal error is logged and the server exits, based on the idea that the
-configuration should be valid at startup. Exiting to the operating system allows
-nanny scripts to detect the problem.
+backends is considered fatal only if ``retry-on-startup`` is set to ``false``
+(the default). A fatal error is logged and the server exits, based on the idea
+that the configuration should be valid at startup. Exiting to the operating
+system allows nanny scripts to detect the problem.
 If ``retry-on-startup`` is set to ``true``, the server will start reconnection
 attempts even at server startup or on reconfigure events, and will honor the
-action specified in ``on-fail`` parameter.
+action specified in the ``on-fail`` parameter.
 
 The host parameter is used by the MySQL and PostgreSQL backends.
 
@@ -774,13 +774,13 @@ The possible values are:
    "Dhcp6": { "hosts-database": { "retry-on-startup" : true, ... }, ... }
 
 During server startup, the inability to connect to any of the configured
-backends is considered fatal only if ``retry-on-startup`` is set to ``false``.
-A fatal error is logged and the server exits, based on the idea that the
-configuration should be valid at startup. Exiting to the operating system allows
-nanny scripts to detect the problem.
+backends is considered fatal only if ``retry-on-startup`` is set to ``false``
+(the default). A fatal error is logged and the server exits, based on the idea
+that the configuration should be valid at startup. Exiting to the operating
+system allows nanny scripts to detect the problem.
 If ``retry-on-startup`` is set to ``true``, the server will start reconnection
 attempts even at server startup or on reconfigure events, and will honor the
-action specified in ``on-fail`` parameter.
+action specified in the ``on-fail`` parameter.
 
 Finally, the credentials of the account under which the server will
 access the database should be set:
index fafaf16a4a90791db2fd8c048ae5fb123de95f78..be2a07c19601a40676048e9ed2935ff8cde36bcc 100644 (file)
@@ -1085,10 +1085,10 @@ the connection to the database backend is not restored according to the
 continues serving clients while this mechanism is activated.
 
 During server startup, the inability to connect to any of the configured
-backends is considered fatal only if ``retry-on-startup`` is set to ``false``.
-A fatal error is logged and the server exits, based on the idea that the
-configuration should be valid at startup. Exiting to the operating system allows
-nanny scripts to detect the problem.
+backends is considered fatal only if ``retry-on-startup`` is set to ``false``
+(the default). A fatal error is logged and the server exits, based on the idea
+that the configuration should be valid at startup. Exiting to the operating
+system allows nanny scripts to detect the problem.
 If ``retry-on-startup`` is set to ``true``, the server will start reconnection
 attempts even at server startup or on reconfigure events, and will honor the
-action specified in ``on-fail`` parameter.
+action specified in the ``on-fail`` parameter.
index 4321d284d947c633736d247329b957301963c128..cf080f891468e7771e47ddc72af041a2c9d33653 100644 (file)
@@ -72,7 +72,7 @@ MySqlConfigBackendImpl(const std::string& space,
     std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR,
                                                MYSQL_SCHEMA_VERSION_MINOR);
 
-    std::string timer_name = "";
+    std::string timer_name;
     bool retry = false;
     if (parameters.count("retry-on-startup")) {
         if (parameters.at("retry-on-startup") == "true") {
index a8f029210eb29193f01a24d2163e2bbd54703c2d..2732f7a62c31aae229f0df5020a6506b676ef2bc 100644 (file)
@@ -117,7 +117,7 @@ PgSqlConfigBackendImpl::PgSqlConfigBackendImpl(const std::string& space,
     std::pair<uint32_t, uint32_t> code_version(PGSQL_SCHEMA_VERSION_MAJOR,
                                                PGSQL_SCHEMA_VERSION_MINOR);
 
-    std::string timer_name = "";
+    std::string timer_name;
     bool retry = false;
     if (parameters.count("retry-on-startup")) {
         if (parameters.at("retry-on-startup") == "true") {
index eb604f7d0dedcd6fb6c81c8c0cb11e0c2c3c4283..b3ac56bc079e10bc58d7b07419e4b483ad43e209 100644 (file)
@@ -818,7 +818,7 @@ public:
     /// B>=A and B=C (it is ok to have newer backend, as it should be backward
     /// compatible)
     /// Also if B>C, some database upgrade procedure may be triggered
-    virtual VersionPair getVersion(const std::string& timer_name = "") const = 0;
+    virtual VersionPair getVersion(const std::string& timer_name = std::string()) const = 0;
 
     /// @brief Commit Transactions
     ///
index bdc6f640bcf960abb1cbbd6033f1372170f72a97..8a84817b597c2bf6f09ed0bd92d0416a4f8465b3 100644 (file)
@@ -2178,7 +2178,7 @@ public:
     ///
     /// @throw isc::dhcp::DbOperationError An operation on the open database
     ///        has failed.
-    std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = "") const;
+    std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = std::string()) const;
 
     /// @brief Executes statements which inserts a row into one of the tables.
     ///
@@ -2884,7 +2884,7 @@ MySqlHostDataSourceImpl::MySqlHostDataSourceImpl(const DatabaseConnection::Param
     std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR,
                                                MYSQL_SCHEMA_VERSION_MINOR);
 
-    std::string timer_name = "";
+    std::string timer_name;
     bool retry = false;
     if (parameters.count("retry-on-startup")) {
         if (parameters.at("retry-on-startup") == "true") {
index 502c9f3896d22b6c9915e8b28d10ee382a8602f9..10643d1183f8e3354e8a562a5106c9b5101c028c 100644 (file)
@@ -465,7 +465,7 @@ public:
     ///
     /// @throw isc::db::DbOperationError An operation on the open database
     ///        has failed.
-    virtual std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = "") const;
+    virtual std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = std::string()) const;
 
     /// @brief Commit Transactions
     ///
index 90af405cd28b6cdc93b39c2fcf08bac1b8826852..6edbd6c3ae4eb38ac30f6902eecd497a90cf2af8 100644 (file)
@@ -2199,7 +2199,7 @@ MySqlLeaseMgr::MySqlLeaseMgr(const DatabaseConnection::ParameterMap& parameters)
     std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR,
                                                MYSQL_SCHEMA_VERSION_MINOR);
 
-    std::string timer_name = "";
+    std::string timer_name;
     bool retry = false;
     if (parameters.count("retry-on-startup")) {
         if (parameters.at("retry-on-startup") == "true") {
index bc673bb5bad488ef700157f2a4fdb84fb880dcf2..b0b6b37348bd9c012b3199e0dc0663493e2e04c8 100644 (file)
@@ -695,7 +695,7 @@ public:
     ///
     /// @throw isc::db::DbOperationError An operation on the open database has
     ///        failed.
-    virtual std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = "") const override;
+    virtual std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = std::string()) const override;
 
     /// @brief Commit Transactions
     ///
index 4abad5afd312567472e036c4bf587b55c1d275f4..6a88942bdc5011c6548c2064b493d39e075be9f5 100644 (file)
@@ -1620,7 +1620,7 @@ public:
     ///
     /// @throw isc::db::DbOperationError An operation on the open database
     ///        has failed.
-    std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = "") const;
+    std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = std::string()) const;
 
     /// @brief The parameters
     DatabaseConnection::ParameterMap parameters_;
@@ -2301,7 +2301,7 @@ PgSqlHostDataSourceImpl::PgSqlHostDataSourceImpl(const DatabaseConnection::Param
     std::pair<uint32_t, uint32_t> code_version(PGSQL_SCHEMA_VERSION_MAJOR,
                                                PGSQL_SCHEMA_VERSION_MINOR);
 
-    std::string timer_name = "";
+    std::string timer_name;
     bool retry = false;
     if (parameters.count("retry-on-startup")) {
         if (parameters.at("retry-on-startup") == "true") {
index 3870e8295cba7cd8e7aefd6fad2f97cff16b50f6..61043c575a45dbb969cd7d2290d812a1b743d341 100644 (file)
@@ -517,7 +517,7 @@ public:
     ///
     /// @throw isc::db::DbOperationError An operation on the open database
     ///        has failed.
-    virtual std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = "") const;
+    virtual std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = std::string()) const;
 
     /// @brief Commit Transactions
     ///
index 23e2c44545f6cb68998c3cab797f1ed726811a71..97c0973ed573110b730f4af4cbe5f65764c80fb7 100644 (file)
@@ -1648,7 +1648,7 @@ PgSqlLeaseMgr::PgSqlLeaseMgr(const DatabaseConnection::ParameterMap& parameters)
     std::pair<uint32_t, uint32_t> code_version(PGSQL_SCHEMA_VERSION_MAJOR,
                                                PGSQL_SCHEMA_VERSION_MINOR);
 
-    std::string timer_name = "";
+    std::string timer_name;
     bool retry = false;
     if (parameters.count("retry-on-startup")) {
         if (parameters.at("retry-on-startup") == "true") {
index c7525a27d7d586b7085b05f4a7a89fff7b6033a7..dd461b1945c3ddf7ae7a0f421344eccc32aba470 100644 (file)
@@ -671,7 +671,7 @@ public:
     ///
     /// @throw isc::db::DbOperationError An operation on the open database has
     ///        failed.
-    virtual std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = "") const override;
+    virtual std::pair<uint32_t, uint32_t> getVersion(const std::string& timer_name = std::string()) const override;
 
     /// @brief Commit Transactions
     ///
index 1bf1dc4e84ede464aee4f926ce4c296db9528adc..8f4e8ba00a4fbf2e69363fbd9ea7cbafab66e571 100644 (file)
@@ -85,6 +85,8 @@ GenericConfigBackendDbLostCallbackTest::testRetryOpenDbLostAndRecoveredCallback(
     std::string access = invalidConnectionString();
     access += " retry-on-startup=true";
 
+    // by adding an invalid access will cause the manager factory to throw
+    // resulting in failure to recreate the manager
     ConfigControlInfoPtr config_ctl_info(new ConfigControlInfo());
     config_ctl_info->addConfigDatabase(access);
     CfgMgr::instance().getCurrentCfg()->setConfigControlInfo(config_ctl_info);
@@ -104,8 +106,6 @@ GenericConfigBackendDbLostCallbackTest::testRetryOpenDbLostAndRecoveredCallback(
 
     access = validConnectionString();
     CfgMgr::instance().clear();
-    // by adding an invalid access will cause the manager factory to throw
-    // resulting in failure to recreate the manager
     config_ctl_info.reset(new ConfigControlInfo());
     config_ctl_info->addConfigDatabase(access);
     CfgMgr::instance().getCurrentCfg()->setConfigControlInfo(config_ctl_info);
@@ -140,6 +140,8 @@ GenericConfigBackendDbLostCallbackTest::testRetryOpenDbLostAndFailedCallback() {
     std::string access = invalidConnectionString();
     access += " retry-on-startup=true";
 
+    // by adding an invalid access will cause the manager factory to throw
+    // resulting in failure to recreate the manager
     ConfigControlInfoPtr config_ctl_info(new ConfigControlInfo());
     config_ctl_info->addConfigDatabase(access);
     CfgMgr::instance().getCurrentCfg()->setConfigControlInfo(config_ctl_info);
@@ -186,6 +188,8 @@ GenericConfigBackendDbLostCallbackTest::testRetryOpenDbLostAndRecoveredAfterTime
     std::string extra = " max-reconnect-tries=3 reconnect-wait-time=1 retry-on-startup=true";
     access += extra;
 
+    // by adding an invalid access will cause the manager factory to throw
+    // resulting in failure to recreate the manager
     ConfigControlInfoPtr config_ctl_info(new ConfigControlInfo());
     config_ctl_info->addConfigDatabase(access);
     CfgMgr::instance().getCurrentCfg()->setConfigControlInfo(config_ctl_info);
@@ -260,6 +264,8 @@ GenericConfigBackendDbLostCallbackTest::testRetryOpenDbLostAndFailedAfterTimeout
     std::string extra = " max-reconnect-tries=3 reconnect-wait-time=1 retry-on-startup=true";
     access += extra;
 
+    // by adding an invalid access will cause the manager factory to throw
+    // resulting in failure to recreate the manager
     ConfigControlInfoPtr config_ctl_info(new ConfigControlInfo());
     config_ctl_info->addConfigDatabase(access);
     CfgMgr::instance().getCurrentCfg()->setConfigControlInfo(config_ctl_info);
@@ -429,6 +435,7 @@ GenericConfigBackendDbLostCallbackTest::testDbLostAndFailedCallback() {
 
     access = invalidConnectionString();
     CfgMgr::instance().clear();
+
     // by adding an invalid access will cause the manager factory to throw
     // resulting in failure to recreate the manager
     config_ctl_info.reset(new ConfigControlInfo());
@@ -494,6 +501,7 @@ GenericConfigBackendDbLostCallbackTest::testDbLostAndRecoveredAfterTimeoutCallba
     access = invalidConnectionString();
     access += extra;
     CfgMgr::instance().clear();
+
     // by adding an invalid access will cause the manager factory to throw
     // resulting in failure to recreate the manager
     config_ctl_info.reset(new ConfigControlInfo());
@@ -584,6 +592,7 @@ GenericConfigBackendDbLostCallbackTest::testDbLostAndFailedAfterTimeoutCallback(
     access = invalidConnectionString();
     access += extra;
     CfgMgr::instance().clear();
+
     // by adding an invalid access will cause the manager factory to throw
     // resulting in failure to recreate the manager
     config_ctl_info.reset(new ConfigControlInfo());