MXS-1775 Move module entry point to the end of the file
Now the same way in all monitors.
This commit is contained in:
@ -46,59 +46,6 @@ static int compare_node_priority(const void*, const void*);
|
|||||||
static GALERA_NODE_INFO *nodeval_dup(const GALERA_NODE_INFO *);
|
static GALERA_NODE_INFO *nodeval_dup(const GALERA_NODE_INFO *);
|
||||||
static void nodeval_free(GALERA_NODE_INFO *);
|
static void nodeval_free(GALERA_NODE_INFO *);
|
||||||
|
|
||||||
/**
|
|
||||||
* The module entry point routine. It is this routine that
|
|
||||||
* must populate the structure that is referred to as the
|
|
||||||
* "module object", this is a structure with the set of
|
|
||||||
* external entry points for this module.
|
|
||||||
*
|
|
||||||
* @return The module object
|
|
||||||
*/
|
|
||||||
extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
|
||||||
{
|
|
||||||
MXS_NOTICE("Initialise the MySQL Galera Monitor module.");
|
|
||||||
|
|
||||||
static MXS_MODULE info =
|
|
||||||
{
|
|
||||||
MXS_MODULE_API_MONITOR,
|
|
||||||
MXS_MODULE_GA,
|
|
||||||
MXS_MONITOR_VERSION,
|
|
||||||
"A Galera cluster monitor",
|
|
||||||
"V2.0.0",
|
|
||||||
MXS_NO_MODULE_CAPABILITIES,
|
|
||||||
&maxscale::MonitorApi<GaleraMonitor>::s_api,
|
|
||||||
NULL, /* Process init. */
|
|
||||||
NULL, /* Process finish. */
|
|
||||||
NULL, /* Thread init. */
|
|
||||||
NULL, /* Thread finish. */
|
|
||||||
{
|
|
||||||
{"disable_master_failback", MXS_MODULE_PARAM_BOOL, "false"},
|
|
||||||
{"available_when_donor", MXS_MODULE_PARAM_BOOL, "false"},
|
|
||||||
{"disable_master_role_setting", MXS_MODULE_PARAM_BOOL, "false"},
|
|
||||||
{"root_node_as_master", MXS_MODULE_PARAM_BOOL, "false"},
|
|
||||||
{"use_priority", MXS_MODULE_PARAM_BOOL, "false"},
|
|
||||||
{
|
|
||||||
"script",
|
|
||||||
MXS_MODULE_PARAM_PATH,
|
|
||||||
NULL,
|
|
||||||
MXS_MODULE_OPT_PATH_X_OK
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"events",
|
|
||||||
MXS_MODULE_PARAM_ENUM,
|
|
||||||
MXS_MONITOR_EVENT_DEFAULT_VALUE,
|
|
||||||
MXS_MODULE_OPT_NONE,
|
|
||||||
mxs_monitor_event_enum_values
|
|
||||||
},
|
|
||||||
{"set_donor_nodes", MXS_MODULE_PARAM_BOOL, "false"},
|
|
||||||
{MXS_END_MODULE_PARAMS}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return &info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GaleraMonitor::GaleraMonitor(MXS_MONITOR *mon)
|
GaleraMonitor::GaleraMonitor(MXS_MONITOR *mon)
|
||||||
: maxscale::MonitorInstance(mon)
|
: maxscale::MonitorInstance(mon)
|
||||||
, m_id(MXS_MONITOR_DEFAULT_ID)
|
, m_id(MXS_MONITOR_DEFAULT_ID)
|
||||||
@ -1167,3 +1114,55 @@ bool GaleraMonitor::detect_cluster_size(const int n_nodes,
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The module entry point routine. It is this routine that
|
||||||
|
* must populate the structure that is referred to as the
|
||||||
|
* "module object", this is a structure with the set of
|
||||||
|
* external entry points for this module.
|
||||||
|
*
|
||||||
|
* @return The module object
|
||||||
|
*/
|
||||||
|
extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||||
|
{
|
||||||
|
MXS_NOTICE("Initialise the MySQL Galera Monitor module.");
|
||||||
|
|
||||||
|
static MXS_MODULE info =
|
||||||
|
{
|
||||||
|
MXS_MODULE_API_MONITOR,
|
||||||
|
MXS_MODULE_GA,
|
||||||
|
MXS_MONITOR_VERSION,
|
||||||
|
"A Galera cluster monitor",
|
||||||
|
"V2.0.0",
|
||||||
|
MXS_NO_MODULE_CAPABILITIES,
|
||||||
|
&maxscale::MonitorApi<GaleraMonitor>::s_api,
|
||||||
|
NULL, /* Process init. */
|
||||||
|
NULL, /* Process finish. */
|
||||||
|
NULL, /* Thread init. */
|
||||||
|
NULL, /* Thread finish. */
|
||||||
|
{
|
||||||
|
{"disable_master_failback", MXS_MODULE_PARAM_BOOL, "false"},
|
||||||
|
{"available_when_donor", MXS_MODULE_PARAM_BOOL, "false"},
|
||||||
|
{"disable_master_role_setting", MXS_MODULE_PARAM_BOOL, "false"},
|
||||||
|
{"root_node_as_master", MXS_MODULE_PARAM_BOOL, "false"},
|
||||||
|
{"use_priority", MXS_MODULE_PARAM_BOOL, "false"},
|
||||||
|
{
|
||||||
|
"script",
|
||||||
|
MXS_MODULE_PARAM_PATH,
|
||||||
|
NULL,
|
||||||
|
MXS_MODULE_OPT_PATH_X_OK
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"events",
|
||||||
|
MXS_MODULE_PARAM_ENUM,
|
||||||
|
MXS_MONITOR_EVENT_DEFAULT_VALUE,
|
||||||
|
MXS_MODULE_OPT_NONE,
|
||||||
|
mxs_monitor_event_enum_values
|
||||||
|
},
|
||||||
|
{"set_donor_nodes", MXS_MODULE_PARAM_BOOL, "false"},
|
||||||
|
{MXS_END_MODULE_PARAMS}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return &info;
|
||||||
|
}
|
||||||
|
|||||||
@ -35,55 +35,6 @@
|
|||||||
static void detectStaleMaster(void *, int);
|
static void detectStaleMaster(void *, int);
|
||||||
static bool isMySQLEvent(mxs_monitor_event_t event);
|
static bool isMySQLEvent(mxs_monitor_event_t event);
|
||||||
|
|
||||||
/**
|
|
||||||
* The module entry point routine. It is this routine that
|
|
||||||
* must populate the structure that is referred to as the
|
|
||||||
* "module object", this is a structure with the set of
|
|
||||||
* external entry points for this module.
|
|
||||||
*
|
|
||||||
* @return The module object
|
|
||||||
*/
|
|
||||||
extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
|
||||||
{
|
|
||||||
MXS_NOTICE("Initialise the Multi-Master Monitor module.");
|
|
||||||
|
|
||||||
static MXS_MODULE info =
|
|
||||||
{
|
|
||||||
MXS_MODULE_API_MONITOR,
|
|
||||||
MXS_MODULE_BETA_RELEASE,
|
|
||||||
MXS_MONITOR_VERSION,
|
|
||||||
"A Multi-Master Multi Master monitor",
|
|
||||||
"V1.1.1",
|
|
||||||
MXS_NO_MODULE_CAPABILITIES,
|
|
||||||
&maxscale::MonitorApi<MMMonitor>::s_api,
|
|
||||||
NULL, /* Process init. */
|
|
||||||
NULL, /* Process finish. */
|
|
||||||
NULL, /* Thread init. */
|
|
||||||
NULL, /* Thread finish. */
|
|
||||||
{
|
|
||||||
{"detect_stale_master", MXS_MODULE_PARAM_BOOL, "false"},
|
|
||||||
{
|
|
||||||
"script",
|
|
||||||
MXS_MODULE_PARAM_PATH,
|
|
||||||
NULL,
|
|
||||||
MXS_MODULE_OPT_PATH_X_OK
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"events",
|
|
||||||
MXS_MODULE_PARAM_ENUM,
|
|
||||||
MXS_MONITOR_EVENT_DEFAULT_VALUE,
|
|
||||||
MXS_MODULE_OPT_NONE,
|
|
||||||
mxs_monitor_event_enum_values
|
|
||||||
},
|
|
||||||
{MXS_END_MODULE_PARAMS}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return &info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint +e14 */
|
|
||||||
|
|
||||||
MMMonitor::MMMonitor(MXS_MONITOR *monitor)
|
MMMonitor::MMMonitor(MXS_MONITOR *monitor)
|
||||||
: maxscale::MonitorInstance(monitor)
|
: maxscale::MonitorInstance(monitor)
|
||||||
, m_id(MXS_MONITOR_DEFAULT_ID)
|
, m_id(MXS_MONITOR_DEFAULT_ID)
|
||||||
@ -418,24 +369,6 @@ void MMMonitor::tick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/Disable the MySQL Replication Stale Master dectection, allowing a previouvsly detected master to still act as a Master.
|
|
||||||
* This option must be enabled in order to keep the Master when the replication is stopped or removed from slaves.
|
|
||||||
* If the replication is still stopped when MaxSclale is restarted no Master will be available.
|
|
||||||
*
|
|
||||||
* @param arg The handle allocated by startMonitor
|
|
||||||
* @param enable To enable it 1, disable it with 0
|
|
||||||
*/
|
|
||||||
/* Not used
|
|
||||||
static void
|
|
||||||
detectStaleMaster(void *arg, int enable)
|
|
||||||
{
|
|
||||||
MONITOR* mon = (MONITOR*) arg;
|
|
||||||
MM_MONITOR *handle = (MM_MONITOR *) mon->handle;
|
|
||||||
memcpy(&handle->detectStaleMaster, &enable, sizeof(int));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*******
|
/*******
|
||||||
* This function returns the master server
|
* This function returns the master server
|
||||||
* from a set of MySQL Multi Master monitored servers
|
* from a set of MySQL Multi Master monitored servers
|
||||||
@ -495,3 +428,50 @@ MXS_MONITORED_SERVER *MMMonitor::get_current_master()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The module entry point routine. It is this routine that
|
||||||
|
* must populate the structure that is referred to as the
|
||||||
|
* "module object", this is a structure with the set of
|
||||||
|
* external entry points for this module.
|
||||||
|
*
|
||||||
|
* @return The module object
|
||||||
|
*/
|
||||||
|
extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||||
|
{
|
||||||
|
MXS_NOTICE("Initialise the Multi-Master Monitor module.");
|
||||||
|
|
||||||
|
static MXS_MODULE info =
|
||||||
|
{
|
||||||
|
MXS_MODULE_API_MONITOR,
|
||||||
|
MXS_MODULE_BETA_RELEASE,
|
||||||
|
MXS_MONITOR_VERSION,
|
||||||
|
"A Multi-Master Multi Master monitor",
|
||||||
|
"V1.1.1",
|
||||||
|
MXS_NO_MODULE_CAPABILITIES,
|
||||||
|
&maxscale::MonitorApi<MMMonitor>::s_api,
|
||||||
|
NULL, /* Process init. */
|
||||||
|
NULL, /* Process finish. */
|
||||||
|
NULL, /* Thread init. */
|
||||||
|
NULL, /* Thread finish. */
|
||||||
|
{
|
||||||
|
{"detect_stale_master", MXS_MODULE_PARAM_BOOL, "false"},
|
||||||
|
{
|
||||||
|
"script",
|
||||||
|
MXS_MODULE_PARAM_PATH,
|
||||||
|
NULL,
|
||||||
|
MXS_MODULE_OPT_PATH_X_OK
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"events",
|
||||||
|
MXS_MODULE_PARAM_ENUM,
|
||||||
|
MXS_MONITOR_EVENT_DEFAULT_VALUE,
|
||||||
|
MXS_MODULE_OPT_NONE,
|
||||||
|
mxs_monitor_event_enum_values
|
||||||
|
},
|
||||||
|
{MXS_END_MODULE_PARAMS}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return &info;
|
||||||
|
}
|
||||||
|
|||||||
@ -23,53 +23,6 @@
|
|||||||
|
|
||||||
bool isNdbEvent(mxs_monitor_event_t event);
|
bool isNdbEvent(mxs_monitor_event_t event);
|
||||||
|
|
||||||
/**
|
|
||||||
* The module entry point routine. It is this routine that
|
|
||||||
* must populate the structure that is referred to as the
|
|
||||||
* "module object", this is a structure with the set of
|
|
||||||
* external entry points for this module.
|
|
||||||
*
|
|
||||||
* @return The module object
|
|
||||||
*/
|
|
||||||
extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
|
||||||
{
|
|
||||||
MXS_NOTICE("Initialise the MySQL Cluster Monitor module.");
|
|
||||||
|
|
||||||
static MXS_MODULE info =
|
|
||||||
{
|
|
||||||
MXS_MODULE_API_MONITOR,
|
|
||||||
MXS_MODULE_BETA_RELEASE,
|
|
||||||
MXS_MONITOR_VERSION,
|
|
||||||
"A MySQL cluster SQL node monitor",
|
|
||||||
"V2.1.0",
|
|
||||||
MXS_NO_MODULE_CAPABILITIES,
|
|
||||||
&maxscale::MonitorApi<NDBCMonitor>::s_api,
|
|
||||||
NULL, /* Process init. */
|
|
||||||
NULL, /* Process finish. */
|
|
||||||
NULL, /* Thread init. */
|
|
||||||
NULL, /* Thread finish. */
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"script",
|
|
||||||
MXS_MODULE_PARAM_PATH,
|
|
||||||
NULL,
|
|
||||||
MXS_MODULE_OPT_PATH_X_OK
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"events",
|
|
||||||
MXS_MODULE_PARAM_ENUM,
|
|
||||||
MXS_MONITOR_EVENT_DEFAULT_VALUE,
|
|
||||||
MXS_MODULE_OPT_NONE,
|
|
||||||
mxs_monitor_event_enum_values
|
|
||||||
},
|
|
||||||
{MXS_END_MODULE_PARAMS} // No parameters
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return &info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NDBCMonitor::NDBCMonitor(MXS_MONITOR *monitor)
|
NDBCMonitor::NDBCMonitor(MXS_MONITOR *monitor)
|
||||||
: maxscale::MonitorInstance(monitor)
|
: maxscale::MonitorInstance(monitor)
|
||||||
, m_id(MXS_MONITOR_DEFAULT_ID)
|
, m_id(MXS_MONITOR_DEFAULT_ID)
|
||||||
@ -202,3 +155,49 @@ void NDBCMonitor::update_server_status(MXS_MONITORED_SERVER* monitored_server)
|
|||||||
monitored_server->server->depth = -1;
|
monitored_server->server->depth = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The module entry point routine. It is this routine that
|
||||||
|
* must populate the structure that is referred to as the
|
||||||
|
* "module object", this is a structure with the set of
|
||||||
|
* external entry points for this module.
|
||||||
|
*
|
||||||
|
* @return The module object
|
||||||
|
*/
|
||||||
|
extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||||
|
{
|
||||||
|
MXS_NOTICE("Initialise the MySQL Cluster Monitor module.");
|
||||||
|
|
||||||
|
static MXS_MODULE info =
|
||||||
|
{
|
||||||
|
MXS_MODULE_API_MONITOR,
|
||||||
|
MXS_MODULE_BETA_RELEASE,
|
||||||
|
MXS_MONITOR_VERSION,
|
||||||
|
"A MySQL cluster SQL node monitor",
|
||||||
|
"V2.1.0",
|
||||||
|
MXS_NO_MODULE_CAPABILITIES,
|
||||||
|
&maxscale::MonitorApi<NDBCMonitor>::s_api,
|
||||||
|
NULL, /* Process init. */
|
||||||
|
NULL, /* Process finish. */
|
||||||
|
NULL, /* Thread init. */
|
||||||
|
NULL, /* Thread finish. */
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"script",
|
||||||
|
MXS_MODULE_PARAM_PATH,
|
||||||
|
NULL,
|
||||||
|
MXS_MODULE_OPT_PATH_X_OK
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"events",
|
||||||
|
MXS_MODULE_PARAM_ENUM,
|
||||||
|
MXS_MONITOR_EVENT_DEFAULT_VALUE,
|
||||||
|
MXS_MODULE_OPT_NONE,
|
||||||
|
mxs_monitor_event_enum_values
|
||||||
|
},
|
||||||
|
{MXS_END_MODULE_PARAMS} // No parameters
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return &info;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user