Revert "Use dedicated header in NDBClusterMon"

This reverts commit b9d80f6061d6b536d7a15febf0367e5f6dba0e84.
This commit is contained in:
Johan Wikman
2018-02-24 15:43:15 +02:00
parent 0bbf0246f9
commit b67ab83486
4 changed files with 33 additions and 22 deletions

View File

@ -17,7 +17,7 @@
#define MXS_MODULE_NAME "mariadbmon" #define MXS_MODULE_NAME "mariadbmon"
#include "mariadbmon.h" #include "../mysqlmon.h"
#include <inttypes.h> #include <inttypes.h>
#include <limits> #include <limits>
#include <string> #include <string>

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifndef _MARIADBMON_H #ifndef _MYSQLMON_H
#define _MARIADBMON_H #define _MYSQLMON_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *

View File

@ -17,7 +17,7 @@
#define MXS_MODULE_NAME "ndbclustermon" #define MXS_MODULE_NAME "ndbclustermon"
#include "ndbclustermon.h" #include "../mysqlmon.h"
#include <maxscale/alloc.h> #include <maxscale/alloc.h>
#include <maxscale/mysql_utils.h> #include <maxscale/mysql_utils.h>
@ -103,7 +103,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
static void * static void *
startMonitor(MXS_MONITOR *mon, const MXS_CONFIG_PARAMETER *params) startMonitor(MXS_MONITOR *mon, const MXS_CONFIG_PARAMETER *params)
{ {
NDBC_MONITOR *handle = mon->handle; MYSQL_MONITOR *handle = mon->handle;
bool have_events = false, script_error = false; bool have_events = false, script_error = false;
if (handle != NULL) if (handle != NULL)
@ -113,7 +113,7 @@ startMonitor(MXS_MONITOR *mon, const MXS_CONFIG_PARAMETER *params)
} }
else else
{ {
if ((handle = (NDBC_MONITOR *) MXS_MALLOC(sizeof(NDBC_MONITOR))) == NULL) if ((handle = (MYSQL_MONITOR *) MXS_MALLOC(sizeof(MYSQL_MONITOR))) == NULL)
{ {
return NULL; return NULL;
} }
@ -154,7 +154,7 @@ startMonitor(MXS_MONITOR *mon, const MXS_CONFIG_PARAMETER *params)
static void static void
stopMonitor(MXS_MONITOR *mon) stopMonitor(MXS_MONITOR *mon)
{ {
NDBC_MONITOR *handle = (NDBC_MONITOR *) mon->handle; MYSQL_MONITOR *handle = (MYSQL_MONITOR *) mon->handle;
handle->shutdown = 1; handle->shutdown = 1;
thread_wait(handle->thread); thread_wait(handle->thread);
@ -306,7 +306,7 @@ monitorDatabase(MXS_MONITORED_SERVER *database, char *defaultUser, char *default
static void static void
monitorMain(void *arg) monitorMain(void *arg)
{ {
NDBC_MONITOR *handle = (NDBC_MONITOR*)arg; MYSQL_MONITOR *handle = (MYSQL_MONITOR*)arg;
MXS_MONITOR* mon = handle->monitor; MXS_MONITOR* mon = handle->monitor;
MXS_MONITORED_SERVER *ptr; MXS_MONITORED_SERVER *ptr;
size_t nrounds = 0; size_t nrounds = 0;

View File

@ -1,6 +1,5 @@
#pragma once #ifndef _MYSQLMON_H
#ifndef _NDBCMON_H #define _MYSQLMON_H
#define _NDBCMON_H
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -14,27 +13,39 @@
* Public License. * Public License.
*/ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <monitor.h>
#include <spinlock.h>
#include <thread.h>
#include <mysql.h>
#include <mysqld_error.h>
#include <log_manager.h>
#include <secrets.h>
#include <dcb.h>
#include <modinfo.h>
#include <config.h>
#include <externcmd.h>
/** /**
* @file ndbclustermon.h - The NDB Cluster monitor * @file ndbclustermon.h - The NDB Cluster monitor
* *
*/ */
#include <maxscale/monitor.h> /**
#include <maxscale/spinlock.h> * The handle for an instance of a NDB Cluster Monitor module
#include <maxscale/thread.h> */
// The handle for an instance of a NDB Cluster Monitor module
typedef struct typedef struct
{ {
THREAD thread; /**< Monitor thread */
SPINLOCK lock; /**< The monitor spinlock */ SPINLOCK lock; /**< The monitor spinlock */
unsigned long id; /**< Monitor ID */ pthread_t tid; /**< id of monitor thread */
uint64_t events; /*< enabled events */
int shutdown; /**< Flag to shutdown the monitor thread */ int shutdown; /**< Flag to shutdown the monitor thread */
int status; /**< Monitor status */ int status; /**< Monitor status */
MXS_MONITORED_SERVER *master; /**< Master server for MySQL Master/Slave replication */ unsigned long id; /**< Monitor ID */
MONITOR_SERVERS *master; /**< Master server for MySQL Master/Slave replication */
char* script; /*< Script to call when state changes occur on servers */ char* script; /*< Script to call when state changes occur on servers */
MXS_MONITOR* monitor; bool events[MAX_MONITOR_EVENT]; /*< enabled events */
} NDBC_MONITOR; } MYSQL_MONITOR;
#endif #endif