MXS-2149 Add REST-API watchdog
This will simply cause a task to be posted to each worker. If the workers are running normally, the task will reach the workers and the associated semaphore posted, and the REST-API call will return. If any worker is not running normally, the task will not be processed and the REST-API call will hang.
This commit is contained in:
parent
1ca03fb85c
commit
809d3549ae
@ -609,3 +609,11 @@ json_t* mxs_rworker_to_json(const char* host, int id);
|
||||
* @see mxs_json_resource()
|
||||
*/
|
||||
json_t* mxs_rworker_list_to_json(const char* host);
|
||||
|
||||
/**
|
||||
* @brief MaxScale worker watchdog
|
||||
*
|
||||
* If this function returns, then MaxScale is alive. If not,
|
||||
* then some thread is dead.
|
||||
*/
|
||||
void mxs_rworker_watchdog();
|
||||
|
@ -900,6 +900,7 @@ HttpResponse cb_modulecmd(const HttpRequest& request)
|
||||
|
||||
HttpResponse cb_send_ok(const HttpRequest& request)
|
||||
{
|
||||
mxs_rworker_watchdog();
|
||||
return HttpResponse(MHD_HTTP_OK);
|
||||
}
|
||||
|
||||
|
@ -1167,3 +1167,28 @@ json_t* mxs_rworker_list_to_json(const char* host)
|
||||
RoutingWorker::execute_concurrently(task);
|
||||
return task.resource();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class WatchdogTask : public Worker::Task
|
||||
{
|
||||
public:
|
||||
WatchdogTask()
|
||||
{
|
||||
}
|
||||
|
||||
void execute(Worker& worker)
|
||||
{
|
||||
// Success if this is called.
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void mxs_rworker_watchdog()
|
||||
{
|
||||
MXS_INFO("MaxScale watchdog called.");
|
||||
WatchdogTask task;
|
||||
RoutingWorker::execute_concurrently(task);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user