MDEV-26971: JSON file interface to wsrep node state.

Fix status reporting - move it from dead code to actually executing.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
This commit is contained in:
Alexey Yurchenko 2022-02-17 17:14:04 +02:00 committed by Sergei Golubchik
parent 7878eae95e
commit eceb9e2478
3 changed files with 11 additions and 14 deletions

View File

@ -17,10 +17,13 @@
#include <mysqld.h> #include <mysqld.h>
#include "wsrep_priv.h" #include "wsrep_priv.h"
#include "wsrep_utils.h" #include "wsrep_utils.h"
#include "wsrep_status.h"
void wsrep_notify_status(enum wsrep::server_state::state status, void wsrep_notify_status(enum wsrep::server_state::state status,
const wsrep::view* view) const wsrep::view* view)
{ {
Wsrep_status::report_state(status);
if (!wsrep_notify_cmd || 0 == strlen(wsrep_notify_cmd)) if (!wsrep_notify_cmd || 0 == strlen(wsrep_notify_cmd))
{ {
WSREP_INFO("wsrep_notify_cmd is not defined, skipping notification."); WSREP_INFO("wsrep_notify_cmd is not defined, skipping notification.");

View File

@ -26,7 +26,6 @@
#include "wsrep_utils.h" #include "wsrep_utils.h"
#include "wsrep_mysqld.h" #include "wsrep_mysqld.h"
#include "wsrep_thd.h" #include "wsrep_thd.h"
#include "wsrep_status.h"
#include <sql_class.h> #include <sql_class.h>
@ -94,18 +93,6 @@ wsrep_prepend_PATH (const char* path)
namespace wsp namespace wsp
{ {
void
node_status::set(enum wsrep::server_state::state new_status,
const wsrep::view* view)
{
if (status != new_status || 0 != view)
{
wsrep_notify_status(new_status, view);
status= new_status;
Wsrep_status::report_state(status);
}
}
bool bool
env::ctor_common(char** e) env::ctor_common(char** e)
{ {

View File

@ -27,7 +27,14 @@ class node_status
public: public:
node_status() : status(wsrep::server_state::s_disconnected) {} node_status() : status(wsrep::server_state::s_disconnected) {}
void set(enum wsrep::server_state::state new_status, void set(enum wsrep::server_state::state new_status,
const wsrep::view* view= 0); const wsrep::view* view= 0)
{
if (status != new_status || 0 != view)
{
wsrep_notify_status(new_status, view);
status= new_status;
}
}
enum wsrep::server_state::state get() const { return status; } enum wsrep::server_state::state get() const { return status; }
private: private:
enum wsrep::server_state::state status; enum wsrep::server_state::state status;