From c476eaaaea147d80dbbb3b1deeb09b6571809e47 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Fri, 26 Mar 2021 16:23:48 +0200 Subject: [PATCH] [#1621] fixed typos and bug which prevents configuring values for "on-fail" --- ChangeLog | 4 +-- doc/sphinx/arm/database-connectivity.rst | 21 +++++++------ doc/sphinx/arm/dhcp4-srv.rst | 38 +++++++++++++++--------- doc/sphinx/arm/dhcp6-srv.rst | 38 +++++++++++++++--------- src/lib/database/database_connection.cc | 4 +-- 5 files changed, 64 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5956b2eaa3..ed9f8265a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,10 +3,10 @@ To achieve this, the "on-fail" connection parameter has been added to control the action performed on connection loss. The supported values are "stop-retry-exit", "serve-retry-exit" and - "server-retry-continue". They indicate if the server should disable + "serve-retry-continue". They indicate if the server should disable the service on connection loss ("stop-retry-exit") or if on recovery failure the server should shut down ("stop-retry-exit" and - "serve-retry-exit") or continue ("server-retry-continue"). + "serve-retry-exit") or continue ("serve-retry-continue"). The default value used (if not configured) is "stop-retry-exit" for lease, host and config backends, and "serve-retry-continue" for forensic log. diff --git a/doc/sphinx/arm/database-connectivity.rst b/doc/sphinx/arm/database-connectivity.rst index 2fb920b373..f7496842c9 100644 --- a/doc/sphinx/arm/database-connectivity.rst +++ b/doc/sphinx/arm/database-connectivity.rst @@ -33,15 +33,18 @@ option and continues to respond to commands. The ``on-fail`` parameter configures the actions the server should take when a connection is lost. It can have one of the following values: -``stop-retry-exit`` which indicates that the server should stop the service -while it tries to recover the connection and exit if recovery is not successful -after ``max-reconnect-tries``. -``serve-retry-exit`` which indicates that the server should not stop the service -while it tries to recover the connection and exit if recovery is not successful -after ``max-reconnect-tries``. -``serve-retry-continue`` which indicates that the server should not stop the -service while it tries to recover the connection and not exit if recovery is not -successful after ``max-reconnect-tries``. + +- ``stop-retry-exit`` which indicates that the server should stop the service + while it tries to recover the connection and exit if recovery is not + successful after ``max-reconnect-tries``. + +- ``serve-retry-exit`` which indicates that the server should not stop the + service while it tries to recover the connection and exit if recovery is not + successful after ``max-reconnect-tries``. + +- ``serve-retry-continue`` which indicates that the server should not stop the + service while it tries to recover the connection and not exit if recovery is + not successful after ``max-reconnect-tries``. If connectivity to all backends is restored, the server returns to normal operations. If the connection can not be restored and the server is configured diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index af84c3b581..6c223b99c9 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -508,13 +508,18 @@ loss of connectivity. The default value for Cassandra is 2000 ms. "Dhcp4": { "lease-database": { "on-fail" : "stop-retry-exit", ... }, ... } -The default value for MySQL and PostgreSQL is ``stop-retry-exit``, which -disables the dhcp service while trying to automatically recover lost connections -and shuts down the server on failure after ``max-reconnect-tries``. -Other valid values are: ``serve-retry-exit`` which does not disable the dhcp -service but shuts down the server on failure after ``max-reconnect-tries`` and -``serve-retry-continue`` which does not disable the dhcp service and does not -shut down the server even if the recovery fails. +The possible values are: + +- ``stop-retry-exit`` disables the DHCP service while trying to automatically + recover lost connections. Shuts down the server on failure after exhausting + ``max-reconnect-tries``. This is the default value for MySQL and PostgreSQL. + +- ``serve-retry-exit`` DHCP service continues while trying to automatically + recover lost connections. Shuts down the server on failure after exhausting + ``max-reconnect-tries``. + +- ``serve-retry-continue`` DHCP service continues and does not shut down the + server even if the recovery fails. .. note:: @@ -732,13 +737,18 @@ loss of connectivity. The default value for Cassandra is 2000 ms. "Dhcp4": { "hosts-database": { "on-fail" : "stop-retry-exit", ... }, ... } -The default value for MySQL and PostgreSQL is ``stop-retry-exit``, which -disables the dhcp service while trying to automatically recover lost connections -and shuts down the server on failure after ``max-reconnect-tries``. -Other valid values are: ``serve-retry-exit`` which does not disable the dhcp -service but shuts down the server on failure after ``max-reconnect-tries`` and -``serve-retry-continue`` which does not disable the dhcp service and does not -shut down the server even if the recovery fails. +The possible values are: + +- ``stop-retry-exit`` disables the DHCP service while trying to automatically + recover lost connections. Shuts down the server on failure after exhausting + ``max-reconnect-tries``. This is the default value for MySQL and PostgreSQL. + +- ``serve-retry-exit`` DHCP service continues while trying to automatically + recover lost connections. Shuts down the server on failure after exhausting + ``max-reconnect-tries``. + +- ``serve-retry-continue`` DHCP service continues and does not shut down the + server even if the recovery fails. .. note:: diff --git a/doc/sphinx/arm/dhcp6-srv.rst b/doc/sphinx/arm/dhcp6-srv.rst index 52b93dea5e..afbb80198c 100644 --- a/doc/sphinx/arm/dhcp6-srv.rst +++ b/doc/sphinx/arm/dhcp6-srv.rst @@ -477,13 +477,18 @@ loss of connectivity. The default value for Cassandra is 2000 ms. "Dhcp6": { "lease-database": { "on-fail" : "stop-retry-exit", ... }, ... } -The default value for MySQL and PostgreSQL is ``stop-retry-exit``, which -disables the dhcp service while trying to automatically recover lost connections -and shuts down the server on failure after ``max-reconnect-tries``. -Other valid values are: ``serve-retry-exit`` which does not disable the dhcp -service but shuts down the server on failure after ``max-reconnect-tries`` and -``serve-retry-continue`` which does not disable the dhcp service and does not -shut down the server even if the recovery fails. +The possible values are: + +- ``stop-retry-exit`` disables the DHCP service while trying to automatically + recover lost connections. Shuts down the server on failure after exhausting + ``max-reconnect-tries``. This is the default value for MySQL and PostgreSQL. + +- ``serve-retry-exit`` DHCP service continues while trying to automatically + recover lost connections. Shuts down the server on failure after exhausting + ``max-reconnect-tries``. + +- ``serve-retry-continue`` DHCP service continues and does not shut down the + server even if the recovery fails. .. note:: @@ -651,13 +656,18 @@ loss of connectivity. The default value for Cassandra is 2000 ms. "Dhcp6": { "hosts-database": { "on-fail" : "stop-retry-exit", ... }, ... } -The default value for MySQL and PostgreSQL is ``stop-retry-exit``, which -disables the dhcp service while trying to automatically recover lost connections -and shuts down the server on failure after ``max-reconnect-tries``. -Other valid values are: ``serve-retry-exit`` which does not disable the dhcp -service but shuts down the server on failure after ``max-reconnect-tries`` and -``serve-retry-continue`` which does not disable the dhcp service and does not -shut down the server even if the recovery fails. +The possible values are: + +- ``stop-retry-exit`` disables the DHCP service while trying to automatically + recover lost connections. Shuts down the server on failure after exhausting + ``max-reconnect-tries``. This is the default value for MySQL and PostgreSQL. + +- ``serve-retry-exit`` DHCP service continues while trying to automatically + recover lost connections. Shuts down the server on failure after exhausting + ``max-reconnect-tries``. + +- ``serve-retry-continue`` DHCP service continues and does not shut down the + server even if the recovery fails. .. note:: diff --git a/src/lib/database/database_connection.cc b/src/lib/database/database_connection.cc index a93a28ebdf..b00e3ab20f 100644 --- a/src/lib/database/database_connection.cc +++ b/src/lib/database/database_connection.cc @@ -282,7 +282,7 @@ ReconnectCtl::onFailActionToText(OnFailAction action) { case OnFailAction::STOP_RETRY_EXIT: return ("stop-retry-exit"); case OnFailAction::SERVE_RETRY_EXIT: - return ("server-retry-exit"); + return ("serve-retry-exit"); case OnFailAction::SERVE_RETRY_CONTINUE: return ("serve-retry-continue"); } @@ -295,7 +295,7 @@ ReconnectCtl::onFailActionFromText(const std::string& text) { return (OnFailAction::STOP_RETRY_EXIT); } else if (text == "serve-retry-exit") { return (OnFailAction::SERVE_RETRY_EXIT); - } else if (text == "server-retry-continue") { + } else if (text == "serve-retry-continue") { return (OnFailAction::SERVE_RETRY_CONTINUE); } else { isc_throw(BadValue, "Invalid action on connection loss: " << text);