Start housekeeper before services
The housekeeper needs to be initialized before services are started.
This commit is contained in:
@ -36,7 +36,9 @@ typedef bool (*TASKFN)(void *data);
|
|||||||
* Initialises the housekeeper mechanism.
|
* Initialises the housekeeper mechanism.
|
||||||
*
|
*
|
||||||
* A call to any of the other housekeeper functions can be made only if
|
* A call to any of the other housekeeper functions can be made only if
|
||||||
* this function returns successfully.
|
* this function returns successfully. This function must be called after all
|
||||||
|
* module level initialization is done but before any monitors or services are
|
||||||
|
* started.
|
||||||
*
|
*
|
||||||
* @return True if the housekeeper mechanism was initialized, false otherwise.
|
* @return True if the housekeeper mechanism was initialized, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
@ -2142,6 +2142,15 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start the housekeeper thread
|
||||||
|
if (!hkinit())
|
||||||
|
{
|
||||||
|
const char* logerr = "Failed to start housekeeper thread.";
|
||||||
|
print_log_n_stderr(true, true, logerr, logerr, 0);
|
||||||
|
rc = MAXSCALE_INTERNALERROR;
|
||||||
|
goto return_main;
|
||||||
|
}
|
||||||
|
|
||||||
/** Start all monitors */
|
/** Start all monitors */
|
||||||
monitorStartAll();
|
monitorStartAll();
|
||||||
|
|
||||||
@ -2176,17 +2185,6 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Start the housekeeper thread
|
|
||||||
*/
|
|
||||||
if (!hkinit())
|
|
||||||
{
|
|
||||||
const char* logerr = "Failed to start housekeeper thread.";
|
|
||||||
print_log_n_stderr(true, true, logerr, logerr, 0);
|
|
||||||
rc = MAXSCALE_INTERNALERROR;
|
|
||||||
goto return_main;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*<
|
/*<
|
||||||
* Start the routing workers running in their own thread.
|
* Start the routing workers running in their own thread.
|
||||||
*/
|
*/
|
||||||
|
@ -256,12 +256,14 @@ json_t* Housekeeper::tasks_json(const char* host)
|
|||||||
|
|
||||||
void hktask_add(const char *name, TASKFN func, void *data, int frequency)
|
void hktask_add(const char *name, TASKFN func, void *data, int frequency)
|
||||||
{
|
{
|
||||||
|
ss_dassert(hk);
|
||||||
Task task(name, func, data, frequency);
|
Task task(name, func, data, frequency);
|
||||||
hk->add(task);
|
hk->add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hktask_remove(const char *name)
|
void hktask_remove(const char *name)
|
||||||
{
|
{
|
||||||
|
ss_dassert(hk);
|
||||||
hk->remove(name);
|
hk->remove(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,6 +295,7 @@ bool hkinit()
|
|||||||
|
|
||||||
void hkshutdown()
|
void hkshutdown()
|
||||||
{
|
{
|
||||||
|
ss_dassert(hk);
|
||||||
hk->stop();
|
hk->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,10 +309,12 @@ void hkfinish()
|
|||||||
|
|
||||||
void hkshow_tasks(DCB *pDcb)
|
void hkshow_tasks(DCB *pDcb)
|
||||||
{
|
{
|
||||||
|
ss_dassert(hk);
|
||||||
hk->print_tasks(pDcb);
|
hk->print_tasks(pDcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
json_t* hk_tasks_json(const char* host)
|
json_t* hk_tasks_json(const char* host)
|
||||||
{
|
{
|
||||||
|
ss_dassert(hk);
|
||||||
return hk->tasks_json(host);
|
return hk->tasks_json(host);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user