MXS-1848 Implement createInstance() and destroyInstance()

CreateInstance() (renamed from initMonitor()) and destroyInstance()
(renamed from finishMonitor()) have now tentatively been
implemented for all monitors.

Next step is to

1) change the prototype of startMonitor() to

       bool (*startMonitor)(MXS_SPECIFIC_MONITOR*,
                            const MXS_MONITOR_PARAMETER*);

   and assume that mon->handle will always contain the
   instance,
2) not delete any data in stopMonitor(),
3) add monitorCreateAll() that calls createInstance() for all
   monitors (and call that in main()), and
4) add monitorDestroyAll() that calls destroyInstance() for
   all monitors (and call that in main()).
This commit is contained in:
Johan Wikman
2018-05-04 15:06:44 +03:00
parent 02cd7b9275
commit 60228f0f26
12 changed files with 300 additions and 115 deletions

View File

@ -38,15 +38,16 @@
*/
struct MM_MONITOR : public MXS_SPECIFIC_MONITOR
{
THREAD thread; /**< Monitor thread */
int shutdown; /**< Flag to shutdown the monitor thread */
int status; /**< Monitor status */
unsigned long id; /**< Monitor ID */
int detectStaleMaster; /**< Monitor flag for Stale Master detection */
THREAD thread; /**< Monitor thread */
int shutdown; /**< Flag to shutdown the monitor thread */
int status; /**< Monitor status */
unsigned long id; /**< Monitor ID */
int detectStaleMaster; /**< Monitor flag for Stale Master detection */
MXS_MONITORED_SERVER *master; /**< Master server for Master/Slave replication */
char* script; /*< Script to call when state changes occur on servers */
uint64_t events; /*< enabled events */
MXS_MONITOR* monitor;
char* script; /**< Script to call when state changes occur on servers */
uint64_t events; /**< enabled events */
MXS_MONITOR* monitor; /**< Pointer to generic monitor structure */
bool checked; /**< Whether server access has been checked */
};
#endif