16 #ifndef ConfigManager_H
17 #define ConfigManager_H
19 #include "MgmtThread.hpp"
21 #include "ConfigSubscriber.hpp"
22 #include "MgmtSrvr.hpp"
23 #include "Defragger.hpp"
25 #include <ConfigRetriever.hpp>
27 #include <SignalSender.hpp>
28 #include <NodeBitmask.hpp>
29 #include <HashMap.hpp>
31 #include <signaldata/ConfigChange.hpp>
38 NdbMutex *m_config_mutex;
44 struct ConfigChangeState {
54 m_current_state(IDLE) {}
56 operator int()
const {
return m_current_state; }
59 void set_config_change_state(ConfigChangeState::States state);
70 ConfigState m_config_state;
71 ConfigState m_previous_state;
77 m_error(ConfigChangeRef::OK),
87 delete m_loaded_config;
89 delete m_initial_config;
95 virtual ~ConfigChange() {
99 ConfigChangeState m_state;
100 BlockReference m_client_ref;
102 ConfigChangeRef::ErrorCode m_error;
103 const Config * m_new_config;
112 Config* m_prepared_config;
121 const char* m_configdir;
126 static Config* load_init_config(
const char*);
127 static Config* load_init_mycnf(
void);
128 Config* load_config(
void)
const;
129 Config* fetch_config(
void);
130 bool save_config(
const Config* conf);
131 bool save_config(
void);
132 bool saved_config_exists(
BaseString& config_name)
const;
133 bool delete_saved_configs(
void)
const;
134 bool failed_config_change_exists(
void)
const;
136 NodeId find_nodeid_from_configdir(
void);
137 NodeId find_nodeid_from_config(
void);
138 bool init_nodeid(
void);
145 bool config_ok(
const Config* conf);
151 bool prepareConfigChange(
const Config* config);
152 void commitConfigChange();
153 void abortConfigChange();
162 void sendConfigChangeRef(
SignalSender& ss, BlockReference,
163 ConfigChangeRef::ErrorCode)
const;
164 void sendConfigChangeConf(
SignalSender& ss, BlockReference)
const;
173 void sendConfigChangeImplRef(
SignalSender& ss, NodeId nodeId,
174 ConfigChangeRef::ErrorCode)
const;
185 void sendConfigCheckRef(
SignalSender& ss, BlockReference to,
186 ConfigCheckRef::ErrorCode,
187 Uint32, Uint32, ConfigState, ConfigState)
const;
188 void sendConfigCheckConf(
SignalSender& ss, BlockReference to)
const;
201 ConfigChecker(
const ConfigChecker&);
203 const char* connect_string,
204 const char* bind_address,
209 bool init_checkers(
const Config* config);
210 void start_checkers();
211 void stop_checkers();
214 void handle_exclude_nodes(
void);
220 NodePair(
int n1,
int n2) : node1(n1), node2(n2) {};
223 bool check(
int& node1,
int& node2)
const;
226 bool set(
int node1,
int node2,
int value);
227 bool get(
int node1,
int node2,
int* value)
const;
230 bool set_in_config(
Config* config);
236 const char* configdir);
255 static Config* load_config(
const char* config_filename,
bool mycnf,
258 bool set_dynamic_port(
int node1,
int node2,
int value,
BaseString& msg);
259 bool get_dynamic_port(
int node1,
int node2,
int *value,