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:
Johan Wikman
2018-11-07 17:18:37 +02:00
parent 1ca03fb85c
commit 809d3549ae
3 changed files with 34 additions and 0 deletions

View File

@ -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);
}