Merge branch '2.2' of github.com:mariadb-corporation/MaxScale into 2.2
This commit is contained in:
@ -76,7 +76,7 @@ const char CN_EVENTS[] = "events";
|
||||
static MXS_MONITOR *allMonitors = NULL;
|
||||
static SPINLOCK monLock = SPINLOCK_INIT;
|
||||
|
||||
static void monitor_server_free_all(MXS_MONITOR_SERVERS *servers);
|
||||
static void monitor_server_free_all(MXS_MONITORED_SERVER *servers);
|
||||
static void remove_server_journal(MXS_MONITOR *monitor);
|
||||
static bool journal_is_stale(MXS_MONITOR *monitor, time_t max_age);
|
||||
|
||||
@ -123,7 +123,7 @@ MXS_MONITOR* monitor_alloc(const char *name, const char *module)
|
||||
mon->name = my_name;
|
||||
mon->module_name = my_module;
|
||||
mon->handle = NULL;
|
||||
mon->databases = NULL;
|
||||
mon->monitored_servers = NULL;
|
||||
*mon->password = '\0';
|
||||
*mon->user = '\0';
|
||||
mon->read_timeout = DEFAULT_READ_TIMEOUT;
|
||||
@ -176,7 +176,7 @@ monitor_free(MXS_MONITOR *mon)
|
||||
}
|
||||
spinlock_release(&monLock);
|
||||
config_parameter_free(mon->parameters);
|
||||
monitor_server_free_all(mon->databases);
|
||||
monitor_server_free_all(mon->monitored_servers);
|
||||
MXS_FREE(mon->name);
|
||||
MXS_FREE(mon->module_name);
|
||||
MXS_FREE(mon);
|
||||
@ -253,7 +253,7 @@ monitorStop(MXS_MONITOR *monitor)
|
||||
monitor->module->stopMonitor(monitor);
|
||||
monitor->state = MONITOR_STATE_STOPPED;
|
||||
|
||||
MXS_MONITOR_SERVERS* db = monitor->databases;
|
||||
MXS_MONITORED_SERVER* db = monitor->monitored_servers;
|
||||
while (db)
|
||||
{
|
||||
// TODO: Create a generic entry point for this or move it inside stopMonitor
|
||||
@ -313,7 +313,7 @@ bool monitorAddServer(MXS_MONITOR *mon, SERVER *server)
|
||||
else
|
||||
{
|
||||
rval = true;
|
||||
MXS_MONITOR_SERVERS *db = (MXS_MONITOR_SERVERS *)MXS_MALLOC(sizeof(MXS_MONITOR_SERVERS));
|
||||
MXS_MONITORED_SERVER *db = (MXS_MONITORED_SERVER *)MXS_MALLOC(sizeof(MXS_MONITORED_SERVER));
|
||||
MXS_ABORT_IF_NULL(db);
|
||||
|
||||
db->server = server;
|
||||
@ -335,13 +335,13 @@ bool monitorAddServer(MXS_MONITOR *mon, SERVER *server)
|
||||
|
||||
spinlock_acquire(&mon->lock);
|
||||
|
||||
if (mon->databases == NULL)
|
||||
if (mon->monitored_servers == NULL)
|
||||
{
|
||||
mon->databases = db;
|
||||
mon->monitored_servers = db;
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_MONITOR_SERVERS *ptr = mon->databases;
|
||||
MXS_MONITORED_SERVER *ptr = mon->monitored_servers;
|
||||
while (ptr->next != NULL)
|
||||
{
|
||||
ptr = ptr->next;
|
||||
@ -359,7 +359,7 @@ bool monitorAddServer(MXS_MONITOR *mon, SERVER *server)
|
||||
return rval;
|
||||
}
|
||||
|
||||
static void monitor_server_free(MXS_MONITOR_SERVERS *tofree)
|
||||
static void monitor_server_free(MXS_MONITORED_SERVER *tofree)
|
||||
{
|
||||
if (tofree)
|
||||
{
|
||||
@ -375,11 +375,11 @@ static void monitor_server_free(MXS_MONITOR_SERVERS *tofree)
|
||||
* Free monitor server list
|
||||
* @param servers Servers to free
|
||||
*/
|
||||
static void monitor_server_free_all(MXS_MONITOR_SERVERS *servers)
|
||||
static void monitor_server_free_all(MXS_MONITORED_SERVER *servers)
|
||||
{
|
||||
while (servers)
|
||||
{
|
||||
MXS_MONITOR_SERVERS *tofree = servers;
|
||||
MXS_MONITORED_SERVER *tofree = servers;
|
||||
servers = servers->next;
|
||||
monitor_server_free(tofree);
|
||||
}
|
||||
@ -402,15 +402,15 @@ void monitorRemoveServer(MXS_MONITOR *mon, SERVER *server)
|
||||
|
||||
spinlock_acquire(&mon->lock);
|
||||
|
||||
MXS_MONITOR_SERVERS *ptr = mon->databases;
|
||||
MXS_MONITORED_SERVER *ptr = mon->monitored_servers;
|
||||
|
||||
if (ptr && ptr->server == server)
|
||||
{
|
||||
mon->databases = mon->databases->next;
|
||||
mon->monitored_servers = mon->monitored_servers->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_MONITOR_SERVERS *prev = ptr;
|
||||
MXS_MONITORED_SERVER *prev = ptr;
|
||||
|
||||
while (ptr)
|
||||
{
|
||||
@ -522,7 +522,7 @@ monitorShow(DCB *dcb, MXS_MONITOR *monitor)
|
||||
|
||||
const char *sep = "";
|
||||
|
||||
for (MXS_MONITOR_SERVERS *db = monitor->databases; db; db = db->next)
|
||||
for (MXS_MONITORED_SERVER *db = monitor->monitored_servers; db; db = db->next)
|
||||
{
|
||||
dcb_printf(dcb, "%s[%s]:%d", sep, db->server->name, db->server->port);
|
||||
sep = ", ";
|
||||
@ -782,7 +782,7 @@ monitorGetList()
|
||||
*/
|
||||
bool check_monitor_permissions(MXS_MONITOR* monitor, const char* query)
|
||||
{
|
||||
if (monitor->databases == NULL || // No servers to check
|
||||
if (monitor->monitored_servers == NULL || // No servers to check
|
||||
config_get_global_options()->skip_permission_checks)
|
||||
{
|
||||
return true;
|
||||
@ -793,7 +793,7 @@ bool check_monitor_permissions(MXS_MONITOR* monitor, const char* query)
|
||||
MXS_CONFIG* cnf = config_get_global_options();
|
||||
bool rval = false;
|
||||
|
||||
for (MXS_MONITOR_SERVERS *mondb = monitor->databases; mondb; mondb = mondb->next)
|
||||
for (MXS_MONITORED_SERVER *mondb = monitor->monitored_servers; mondb; mondb = mondb->next)
|
||||
{
|
||||
if (mon_ping_or_connect_to_db(monitor, mondb) != MONITOR_CONN_OK)
|
||||
{
|
||||
@ -912,7 +912,7 @@ bool monitorRemoveParameter(MXS_MONITOR *monitor, const char *key)
|
||||
* @param bit The bit to clear for the server
|
||||
*/
|
||||
void
|
||||
monitor_set_pending_status(MXS_MONITOR_SERVERS *ptr, int bit)
|
||||
monitor_set_pending_status(MXS_MONITORED_SERVER *ptr, int bit)
|
||||
{
|
||||
ptr->pending_status |= bit;
|
||||
}
|
||||
@ -924,7 +924,7 @@ monitor_set_pending_status(MXS_MONITOR_SERVERS *ptr, int bit)
|
||||
* @param bit The bit to clear for the server
|
||||
*/
|
||||
void
|
||||
monitor_clear_pending_status(MXS_MONITOR_SERVERS *ptr, int bit)
|
||||
monitor_clear_pending_status(MXS_MONITORED_SERVER *ptr, int bit)
|
||||
{
|
||||
ptr->pending_status &= ~bit;
|
||||
}
|
||||
@ -936,7 +936,7 @@ monitor_clear_pending_status(MXS_MONITOR_SERVERS *ptr, int bit)
|
||||
* @param node The monitor server data for a particular server
|
||||
* @result monitor_event_t A monitor event (enum)
|
||||
*/
|
||||
static mxs_monitor_event_t mon_get_event_type(MXS_MONITOR_SERVERS* node)
|
||||
static mxs_monitor_event_t mon_get_event_type(MXS_MONITORED_SERVER* node)
|
||||
{
|
||||
typedef enum
|
||||
{
|
||||
@ -1052,7 +1052,7 @@ static mxs_monitor_event_t mon_get_event_type(MXS_MONITOR_SERVERS* node)
|
||||
* @param node The monitor server data whose event is wanted
|
||||
* @result string The name of the monitor event for the server
|
||||
*/
|
||||
static const char* mon_get_event_name(MXS_MONITOR_SERVERS* node)
|
||||
static const char* mon_get_event_name(MXS_MONITORED_SERVER* node)
|
||||
{
|
||||
mxs_monitor_event_t event = mon_get_event_type(node);
|
||||
|
||||
@ -1075,7 +1075,7 @@ static const char* mon_get_event_name(MXS_MONITOR_SERVERS* node)
|
||||
* @param dest Destination where the string is appended, must be null terminated
|
||||
* @param len Length of @c dest
|
||||
*/
|
||||
static void mon_append_node_names(MXS_MONITOR_SERVERS* servers, char* dest, int len, int status)
|
||||
static void mon_append_node_names(MXS_MONITORED_SERVER* servers, char* dest, int len, int status)
|
||||
{
|
||||
const char *separator = "";
|
||||
char arr[MAX_SERVER_ADDRESS_LEN + 64]; // Some extra space for port and separator
|
||||
@ -1106,7 +1106,7 @@ static void mon_append_node_names(MXS_MONITOR_SERVERS* servers, char* dest, int
|
||||
* @param mon_srv The monitored server
|
||||
* @return true if status has changed or false
|
||||
*/
|
||||
bool mon_status_changed(MXS_MONITOR_SERVERS* mon_srv)
|
||||
bool mon_status_changed(MXS_MONITORED_SERVER* mon_srv)
|
||||
{
|
||||
bool rval = false;
|
||||
|
||||
@ -1140,19 +1140,19 @@ bool mon_status_changed(MXS_MONITOR_SERVERS* mon_srv)
|
||||
* @return true if failed status can be logged or false
|
||||
*/
|
||||
bool
|
||||
mon_print_fail_status(MXS_MONITOR_SERVERS* mon_srv)
|
||||
mon_print_fail_status(MXS_MONITORED_SERVER* mon_srv)
|
||||
{
|
||||
return (SERVER_IS_DOWN(mon_srv->server) && mon_srv->mon_err_count == 0);
|
||||
}
|
||||
|
||||
static MXS_MONITOR_SERVERS* find_parent_node(MXS_MONITOR_SERVERS* servers,
|
||||
MXS_MONITOR_SERVERS* target)
|
||||
static MXS_MONITORED_SERVER* find_parent_node(MXS_MONITORED_SERVER* servers,
|
||||
MXS_MONITORED_SERVER* target)
|
||||
{
|
||||
MXS_MONITOR_SERVERS* rval = NULL;
|
||||
MXS_MONITORED_SERVER* rval = NULL;
|
||||
|
||||
if (target->server->master_id > 0)
|
||||
{
|
||||
for (MXS_MONITOR_SERVERS* node = servers; node; node = node->next)
|
||||
for (MXS_MONITORED_SERVER* node = servers; node; node = node->next)
|
||||
{
|
||||
if (node->server->node_id == target->server->master_id)
|
||||
{
|
||||
@ -1165,8 +1165,8 @@ static MXS_MONITOR_SERVERS* find_parent_node(MXS_MONITOR_SERVERS* servers,
|
||||
return rval;
|
||||
}
|
||||
|
||||
static std::string child_nodes(MXS_MONITOR_SERVERS* servers,
|
||||
MXS_MONITOR_SERVERS* parent)
|
||||
static std::string child_nodes(MXS_MONITORED_SERVER* servers,
|
||||
MXS_MONITORED_SERVER* parent)
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
||||
@ -1174,7 +1174,7 @@ static std::string child_nodes(MXS_MONITOR_SERVERS* servers,
|
||||
{
|
||||
bool have_content = false;
|
||||
|
||||
for (MXS_MONITOR_SERVERS* node = servers; node; node = node->next)
|
||||
for (MXS_MONITORED_SERVER* node = servers; node; node = node->next)
|
||||
{
|
||||
if (node->server->master_id == parent->server->node_id)
|
||||
{
|
||||
@ -1199,7 +1199,7 @@ static std::string child_nodes(MXS_MONITOR_SERVERS* servers,
|
||||
* @param script Script to execute
|
||||
*/
|
||||
void
|
||||
monitor_launch_script(MXS_MONITOR* mon, MXS_MONITOR_SERVERS* ptr, const char* script)
|
||||
monitor_launch_script(MXS_MONITOR* mon, MXS_MONITORED_SERVER* ptr, const char* script)
|
||||
{
|
||||
char arg[strlen(script) + 1];
|
||||
strcpy(arg, script);
|
||||
@ -1223,7 +1223,7 @@ monitor_launch_script(MXS_MONITOR* mon, MXS_MONITOR_SERVERS* ptr, const char* sc
|
||||
if (externcmd_matches(cmd, "$PARENT"))
|
||||
{
|
||||
std::stringstream ss;
|
||||
MXS_MONITOR_SERVERS* parent = find_parent_node(mon->databases, ptr);
|
||||
MXS_MONITORED_SERVER* parent = find_parent_node(mon->monitored_servers, ptr);
|
||||
|
||||
if (parent)
|
||||
{
|
||||
@ -1234,7 +1234,7 @@ monitor_launch_script(MXS_MONITOR* mon, MXS_MONITOR_SERVERS* ptr, const char* sc
|
||||
|
||||
if (externcmd_matches(cmd, "$CHILDREN"))
|
||||
{
|
||||
externcmd_substitute_arg(cmd, "[$]CHILDREN", child_nodes(mon->databases, ptr).c_str());
|
||||
externcmd_substitute_arg(cmd, "[$]CHILDREN", child_nodes(mon->monitored_servers, ptr).c_str());
|
||||
}
|
||||
|
||||
if (externcmd_matches(cmd, "$EVENT"))
|
||||
@ -1246,31 +1246,31 @@ monitor_launch_script(MXS_MONITOR* mon, MXS_MONITOR_SERVERS* ptr, const char* sc
|
||||
|
||||
if (externcmd_matches(cmd, "$NODELIST"))
|
||||
{
|
||||
mon_append_node_names(mon->databases, nodelist, sizeof(nodelist), SERVER_RUNNING);
|
||||
mon_append_node_names(mon->monitored_servers, nodelist, sizeof(nodelist), SERVER_RUNNING);
|
||||
externcmd_substitute_arg(cmd, "[$]NODELIST", nodelist);
|
||||
}
|
||||
|
||||
if (externcmd_matches(cmd, "$LIST"))
|
||||
{
|
||||
mon_append_node_names(mon->databases, nodelist, sizeof(nodelist), 0);
|
||||
mon_append_node_names(mon->monitored_servers, nodelist, sizeof(nodelist), 0);
|
||||
externcmd_substitute_arg(cmd, "[$]LIST", nodelist);
|
||||
}
|
||||
|
||||
if (externcmd_matches(cmd, "$MASTERLIST"))
|
||||
{
|
||||
mon_append_node_names(mon->databases, nodelist, sizeof(nodelist), SERVER_MASTER);
|
||||
mon_append_node_names(mon->monitored_servers, nodelist, sizeof(nodelist), SERVER_MASTER);
|
||||
externcmd_substitute_arg(cmd, "[$]MASTERLIST", nodelist);
|
||||
}
|
||||
|
||||
if (externcmd_matches(cmd, "$SLAVELIST"))
|
||||
{
|
||||
mon_append_node_names(mon->databases, nodelist, sizeof(nodelist), SERVER_SLAVE);
|
||||
mon_append_node_names(mon->monitored_servers, nodelist, sizeof(nodelist), SERVER_SLAVE);
|
||||
externcmd_substitute_arg(cmd, "[$]SLAVELIST", nodelist);
|
||||
}
|
||||
|
||||
if (externcmd_matches(cmd, "$SYNCEDLIST"))
|
||||
{
|
||||
mon_append_node_names(mon->databases, nodelist, sizeof(nodelist), SERVER_JOINED);
|
||||
mon_append_node_names(mon->monitored_servers, nodelist, sizeof(nodelist), SERVER_JOINED);
|
||||
externcmd_substitute_arg(cmd, "[$]SYNCEDLIST", nodelist);
|
||||
}
|
||||
|
||||
@ -1352,7 +1352,7 @@ monitor_launch_script(MXS_MONITOR* mon, MXS_MONITOR_SERVERS* ptr, const char* sc
|
||||
* @return MONITOR_CONN_OK if the connection is OK, else the reason for the failure
|
||||
*/
|
||||
mxs_connect_result_t
|
||||
mon_ping_or_connect_to_db(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
|
||||
mon_ping_or_connect_to_db(MXS_MONITOR* mon, MXS_MONITORED_SERVER *database)
|
||||
{
|
||||
/** Return if the connection is OK */
|
||||
if (database->con && mysql_ping(database->con) == 0)
|
||||
@ -1417,7 +1417,7 @@ mon_ping_or_connect_to_db(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
|
||||
* @param rval Return value of mon_connect_to_db
|
||||
*/
|
||||
void
|
||||
mon_log_connect_error(MXS_MONITOR_SERVERS* database, mxs_connect_result_t rval)
|
||||
mon_log_connect_error(MXS_MONITORED_SERVER* database, mxs_connect_result_t rval)
|
||||
{
|
||||
MXS_ERROR(rval == MONITOR_CONN_TIMEOUT ?
|
||||
"Monitor timed out when connecting to server [%s]:%d : \"%s\"" :
|
||||
@ -1426,7 +1426,7 @@ mon_log_connect_error(MXS_MONITOR_SERVERS* database, mxs_connect_result_t rval)
|
||||
mysql_error(database->con));
|
||||
}
|
||||
|
||||
static void mon_log_state_change(MXS_MONITOR_SERVERS *ptr)
|
||||
static void mon_log_state_change(MXS_MONITORED_SERVER *ptr)
|
||||
{
|
||||
SERVER srv;
|
||||
srv.status = ptr->mon_prev_status;
|
||||
@ -1451,7 +1451,7 @@ MXS_MONITOR* monitor_server_in_use(const SERVER *server)
|
||||
|
||||
if (mon->active)
|
||||
{
|
||||
for (MXS_MONITOR_SERVERS *db = mon->databases; db && !rval; db = db->next)
|
||||
for (MXS_MONITORED_SERVER *db = mon->monitored_servers; db && !rval; db = db->next)
|
||||
{
|
||||
if (db->server == server)
|
||||
{
|
||||
@ -1492,12 +1492,12 @@ static bool create_monitor_config(const MXS_MONITOR *monitor, const char *filena
|
||||
dprintf(file, "%s=%ld\n", CN_JOURNAL_MAX_AGE, monitor->journal_max_age);
|
||||
dprintf(file, "%s=%d\n", CN_SCRIPT_TIMEOUT, monitor->script_timeout);
|
||||
|
||||
if (monitor->databases)
|
||||
if (monitor->monitored_servers)
|
||||
{
|
||||
dprintf(file, "%s=", CN_SERVERS);
|
||||
for (MXS_MONITOR_SERVERS *db = monitor->databases; db; db = db->next)
|
||||
for (MXS_MONITORED_SERVER *db = monitor->monitored_servers; db; db = db->next)
|
||||
{
|
||||
if (db != monitor->databases)
|
||||
if (db != monitor->monitored_servers)
|
||||
{
|
||||
dprintf(file, ",");
|
||||
}
|
||||
@ -1575,7 +1575,7 @@ bool monitor_serialize(const MXS_MONITOR *monitor)
|
||||
|
||||
void mon_hangup_failed_servers(MXS_MONITOR *monitor)
|
||||
{
|
||||
for (MXS_MONITOR_SERVERS *ptr = monitor->databases; ptr; ptr = ptr->next)
|
||||
for (MXS_MONITORED_SERVER *ptr = monitor->monitored_servers; ptr; ptr = ptr->next)
|
||||
{
|
||||
if (mon_status_changed(ptr) &&
|
||||
(!(SERVER_IS_RUNNING(ptr->server)) ||
|
||||
@ -1586,7 +1586,7 @@ void mon_hangup_failed_servers(MXS_MONITOR *monitor)
|
||||
}
|
||||
}
|
||||
|
||||
void mon_report_query_error(MXS_MONITOR_SERVERS* db)
|
||||
void mon_report_query_error(MXS_MONITORED_SERVER* db)
|
||||
{
|
||||
MXS_ERROR("Failed to execute query on server '%s' ([%s]:%d): %s",
|
||||
db->server->unique_name, db->server->name,
|
||||
@ -1600,7 +1600,7 @@ void mon_report_query_error(MXS_MONITOR_SERVERS* db)
|
||||
*/
|
||||
void lock_monitor_servers(MXS_MONITOR *monitor)
|
||||
{
|
||||
MXS_MONITOR_SERVERS *ptr = monitor->databases;
|
||||
MXS_MONITORED_SERVER *ptr = monitor->monitored_servers;
|
||||
while (ptr)
|
||||
{
|
||||
spinlock_acquire(&ptr->server->lock);
|
||||
@ -1614,7 +1614,7 @@ void lock_monitor_servers(MXS_MONITOR *monitor)
|
||||
*/
|
||||
void release_monitor_servers(MXS_MONITOR *monitor)
|
||||
{
|
||||
MXS_MONITOR_SERVERS *ptr = monitor->databases;
|
||||
MXS_MONITORED_SERVER *ptr = monitor->monitored_servers;
|
||||
while (ptr)
|
||||
{
|
||||
spinlock_release(&ptr->server->lock);
|
||||
@ -1629,7 +1629,7 @@ void release_monitor_servers(MXS_MONITOR *monitor)
|
||||
*/
|
||||
void servers_status_pending_to_current(MXS_MONITOR *monitor)
|
||||
{
|
||||
MXS_MONITOR_SERVERS *ptr = monitor->databases;
|
||||
MXS_MONITORED_SERVER *ptr = monitor->monitored_servers;
|
||||
while (ptr)
|
||||
{
|
||||
ptr->server->status = ptr->server->status_pending;
|
||||
@ -1645,7 +1645,7 @@ void servers_status_pending_to_current(MXS_MONITOR *monitor)
|
||||
*/
|
||||
void servers_status_current_to_pending(MXS_MONITOR *monitor)
|
||||
{
|
||||
MXS_MONITOR_SERVERS *ptr = monitor->databases;
|
||||
MXS_MONITORED_SERVER *ptr = monitor->monitored_servers;
|
||||
while (ptr)
|
||||
{
|
||||
ptr->server->status_pending = ptr->server->status;
|
||||
@ -1655,7 +1655,7 @@ void servers_status_current_to_pending(MXS_MONITOR *monitor)
|
||||
|
||||
void mon_process_state_changes(MXS_MONITOR *monitor, const char *script, uint64_t events)
|
||||
{
|
||||
for (MXS_MONITOR_SERVERS *ptr = monitor->databases; ptr; ptr = ptr->next)
|
||||
for (MXS_MONITORED_SERVER *ptr = monitor->monitored_servers; ptr; ptr = ptr->next)
|
||||
{
|
||||
if (mon_status_changed(ptr))
|
||||
{
|
||||
@ -1748,11 +1748,11 @@ json_t* monitor_json_data(const MXS_MONITOR* monitor, const char* host)
|
||||
json_t* rel = json_object();
|
||||
|
||||
|
||||
if (monitor->databases)
|
||||
if (monitor->monitored_servers)
|
||||
{
|
||||
json_t* mon_rel = mxs_json_relationship(host, MXS_JSON_API_SERVERS);
|
||||
|
||||
for (MXS_MONITOR_SERVERS *db = monitor->databases; db; db = db->next)
|
||||
for (MXS_MONITORED_SERVER *db = monitor->monitored_servers; db; db = db->next)
|
||||
{
|
||||
mxs_json_add_relation(mon_rel, db->server->unique_name, CN_SERVERS);
|
||||
}
|
||||
@ -1812,7 +1812,7 @@ json_t* monitor_relations_to_server(const SERVER* server, const char* host)
|
||||
|
||||
if (mon->active)
|
||||
{
|
||||
for (MXS_MONITOR_SERVERS* db = mon->databases; db; db = db->next)
|
||||
for (MXS_MONITORED_SERVER* db = mon->monitored_servers; db; db = db->next)
|
||||
{
|
||||
if (db->server == server)
|
||||
{
|
||||
@ -1900,7 +1900,7 @@ static FILE* open_tmp_file(MXS_MONITOR *monitor, char *path)
|
||||
* PATH_MAX bytes long
|
||||
* @param size Size of @c data
|
||||
*/
|
||||
static void store_data(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS *master, uint8_t *data, uint32_t size)
|
||||
static void store_data(MXS_MONITOR *monitor, MXS_MONITORED_SERVER *master, uint8_t *data, uint32_t size)
|
||||
{
|
||||
uint8_t* ptr = data;
|
||||
|
||||
@ -1912,7 +1912,7 @@ static void store_data(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS *master, uint8_
|
||||
*ptr++ = MMB_SCHEMA_VERSION;
|
||||
|
||||
/** Store the states of all servers */
|
||||
for (MXS_MONITOR_SERVERS* db = monitor->databases; db; db = db->next)
|
||||
for (MXS_MONITORED_SERVER* db = monitor->monitored_servers; db; db = db->next)
|
||||
{
|
||||
*ptr++ = (char)SVT_SERVER; // Value type
|
||||
memcpy(ptr, db->server->unique_name, strlen(db->server->unique_name)); // Name of the server
|
||||
@ -1998,7 +1998,7 @@ static bool has_null_terminator(const char *data, const char *end)
|
||||
*/
|
||||
static const char* process_server(MXS_MONITOR *monitor, const char *data, const char *end)
|
||||
{
|
||||
for (MXS_MONITOR_SERVERS* db = monitor->databases; db; db = db->next)
|
||||
for (MXS_MONITORED_SERVER* db = monitor->monitored_servers; db; db = db->next)
|
||||
{
|
||||
if (strcmp(db->server->unique_name, data) == 0)
|
||||
{
|
||||
@ -2023,12 +2023,12 @@ static const char* process_server(MXS_MONITOR *monitor, const char *data, const
|
||||
/**
|
||||
* Process a master
|
||||
*/
|
||||
static const char* process_master(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS **master, const char *data,
|
||||
static const char* process_master(MXS_MONITOR *monitor, MXS_MONITORED_SERVER **master, const char *data,
|
||||
const char *end)
|
||||
{
|
||||
if (master)
|
||||
{
|
||||
for (MXS_MONITOR_SERVERS* db = monitor->databases; db; db = db->next)
|
||||
for (MXS_MONITORED_SERVER* db = monitor->monitored_servers; db; db = db->next)
|
||||
{
|
||||
if (strcmp(db->server->unique_name, data) == 0)
|
||||
{
|
||||
@ -2057,7 +2057,7 @@ static bool check_crc32(const uint8_t *data, uint32_t size, const uint8_t *crc_p
|
||||
/**
|
||||
* Process the stored journal data
|
||||
*/
|
||||
static bool process_data_file(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS **master, const char *data,
|
||||
static bool process_data_file(MXS_MONITOR *monitor, MXS_MONITORED_SERVER **master, const char *data,
|
||||
const char *crc_ptr)
|
||||
{
|
||||
const char *ptr = data;
|
||||
@ -2097,12 +2097,12 @@ static bool process_data_file(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS **master
|
||||
return true;
|
||||
}
|
||||
|
||||
void store_server_journal(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS *master)
|
||||
void store_server_journal(MXS_MONITOR *monitor, MXS_MONITORED_SERVER *master)
|
||||
{
|
||||
/** Calculate how much memory we need to allocate */
|
||||
uint32_t size = MMB_LEN_SCHEMA_VERSION + MMB_LEN_CRC32;
|
||||
|
||||
for (MXS_MONITOR_SERVERS* db = monitor->databases; db; db = db->next)
|
||||
for (MXS_MONITORED_SERVER* db = monitor->monitored_servers; db; db = db->next)
|
||||
{
|
||||
/** Each server is stored as a type byte and a null-terminated string
|
||||
* followed by eight byte server status. */
|
||||
@ -2148,7 +2148,7 @@ void store_server_journal(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS *master)
|
||||
MXS_FREE(data);
|
||||
}
|
||||
|
||||
void load_server_journal(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS **master)
|
||||
void load_server_journal(MXS_MONITOR *monitor, MXS_MONITORED_SERVER **master)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
FILE *file = open_data_file(monitor, path);
|
||||
|
Reference in New Issue
Block a user