From 1fcb62895ed7546834f77fd0c22069ddec51d408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 14 Jun 2017 11:50:30 +0300 Subject: [PATCH] Add fatal failure checking method to Backend The method allows the caller to check whether the backend has suffered a fatal failure. --- include/maxscale/backend.hh | 11 +++++++++++ server/core/backend.cc | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/include/maxscale/backend.hh b/include/maxscale/backend.hh index 2ca4a1590..0fc213165 100644 --- a/include/maxscale/backend.hh +++ b/include/maxscale/backend.hh @@ -182,6 +182,17 @@ public: */ bool is_closed() const; + /** + * @brief Check if the backend has failed fatally + * + * When a fatal failure occurs in a backend, the backend server can no longer + * be used by this session. Fatal failures can occur when the execution of + * a session command fails on the backend but the expected result is different. + * + * @return True if a fatal failure has occurred in the backend server + */ + bool has_failed() const; + private: /** * Internal state of the backend diff --git a/server/core/backend.cc b/server/core/backend.cc index 5d86fdf74..88f72a281 100644 --- a/server/core/backend.cc +++ b/server/core/backend.cc @@ -241,3 +241,8 @@ bool Backend::is_closed() const { return m_state & CLOSED; } + +bool Backend::has_failed() const +{ + return m_state & FATAL_FAILURE; +}