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

@ -20,13 +20,14 @@
// The handle for an instance of a NDB Cluster Monitor module
struct NDBC_MONITOR : public MXS_SPECIFIC_MONITOR
{
THREAD thread; /**< Monitor thread */
SPINLOCK lock; /**< The monitor spinlock */
unsigned long id; /**< Monitor ID */
uint64_t events; /*< enabled events */
int shutdown; /**< Flag to shutdown the monitor thread */
int status; /**< Monitor status */
THREAD thread; /**< Monitor thread */
SPINLOCK lock; /**< The monitor spinlock */
unsigned long id; /**< Monitor ID */
uint64_t events; /**< enabled events */
int shutdown; /**< Flag to shutdown the monitor thread */
int status; /**< Monitor status */
MXS_MONITORED_SERVER *master; /**< Master server for MySQL Master/Slave replication */
char* script; /*< Script to call when state changes occur on servers */
MXS_MONITOR* monitor;
char* script; /**< Script to call when state changes occur on servers */
MXS_MONITOR* monitor; /**< Pointer to generic monitor structure */
bool checked; /**< Whether server access has been checked */
};