From e1e172fe0308b8647f3f6622b6430043f746cfe8 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Tue, 24 Jun 2014 18:37:17 +0200 Subject: [PATCH] Fixed compile errors Fixed compile errors --- server/include/server.h | 3 ++- server/modules/monitor/mysql_mon.c | 8 ++++---- server/modules/monitor/mysqlmon.h | 21 +++++++++++---------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/server/include/server.h b/server/include/server.h index 6a621525b..37f6ca734 100644 --- a/server/include/server.h +++ b/server/include/server.h @@ -71,8 +71,9 @@ typedef struct server { long node_id; /**< Node id, server_id for M/S or local_index for Galera */ int rlag; /**< Replication Lag for Master / Slave replication */ unsigned long node_ts; /**< Last timestamp set from M/S monitor module */ - int depth; /**< Replication level in the tree */ int master_id; /**< Master server id of this node */ + int depth; /**< Replication level in the tree */ + char slaves[100]; /**< Slaves of this node */ } SERVER; /** diff --git a/server/modules/monitor/mysql_mon.c b/server/modules/monitor/mysql_mon.c index 6a41d8ebb..5a3acf8e4 100644 --- a/server/modules/monitor/mysql_mon.c +++ b/server/modules/monitor/mysql_mon.c @@ -386,8 +386,8 @@ static int conn_err_count; server_clear_status(database->server, SERVER_RUNNING); /* clear M/S status */ - server_clear_status(ptr->server, SERVER_SLAVE); - server_clear_status(ptr->server, SERVER_MASTER); + server_clear_status(database->server, SERVER_SLAVE); + server_clear_status(database->server, SERVER_MASTER); return; } @@ -476,7 +476,7 @@ static int conn_err_count; } } /* store master_id of current node */ - memcpy(&database->server->master_id, &master_server_id, sizeof(int)); + memcpy(&database->server->master_id, &master_id, sizeof(int)); mysql_free_result(result); } @@ -872,7 +872,7 @@ static void set_slave_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *database database->server->rlag = -1; database->server->node_ts = 0; - if (handle->master->node_id < 0) { + if (handle->master->server->node_id < 0) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "[mysql_mon]: error: replication heartbeat: " diff --git a/server/modules/monitor/mysqlmon.h b/server/modules/monitor/mysqlmon.h index 5b5c7d04a..c79edf9d3 100644 --- a/server/modules/monitor/mysqlmon.h +++ b/server/modules/monitor/mysqlmon.h @@ -31,6 +31,7 @@ * 08/07/13 Mark Riddoch Initial implementation * 26/05/14 Massimiliano Pinto Default values for MONITOR_INTERVAL * 28/05/14 Massimiliano Pinto Addition of new fields in MYSQL_MONITOR struct + * 24/06/14 Massimiliano Pinto Addition of master field in MYSQL_MONITOR struct * * @endverbatim */ @@ -52,17 +53,17 @@ typedef struct monitor_servers { * The handle for an instance of a MySQL Monitor module */ typedef struct { - SPINLOCK lock; /**< The monitor spinlock */ - pthread_t tid; /**< id of monitor thread */ - int shutdown; /**< Flag to shutdown the monitor thread */ - int status; /**< Monitor status */ - char *defaultUser; /**< Default username for monitoring */ - char *defaultPasswd; /**< Default password for monitoring */ - unsigned long interval; /**< Monitor sampling interval */ - unsigned long id; /**< Monitor ID */ + SPINLOCK lock; /**< The monitor spinlock */ + pthread_t tid; /**< id of monitor thread */ + int shutdown; /**< Flag to shutdown the monitor thread */ + int status; /**< Monitor status */ + char *defaultUser; /**< Default username for monitoring */ + char *defaultPasswd; /**< Default password for monitoring */ + unsigned long interval; /**< Monitor sampling interval */ + unsigned long id; /**< Monitor ID */ int replicationHeartbeat; /**< Monitor flag for MySQL replication heartbeat */ - int master_id; /**< Master server-id for MySQL Master/Slave replication */ - MONITOR_SERVERS *databases; /**< Linked list of servers to monitor */ + MONITOR_SERVERS *master; /**< Master server for MySQL Master/Slave replication */ + MONITOR_SERVERS *databases; /**< Linked list of servers to monitor */ } MYSQL_MONITOR; #define MONITOR_RUNNING 1