From 0638ea736e42811ad562c9ca1ddd9fe9e27caa2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 6 May 2019 15:17:42 +0300 Subject: [PATCH] Write slave heartbeat in correct thread The writing should be done on the worker that owns the DCB. --- server/modules/routing/binlogrouter/blr_slave.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/modules/routing/binlogrouter/blr_slave.cc b/server/modules/routing/binlogrouter/blr_slave.cc index f0fa49940..ed77b0e38 100644 --- a/server/modules/routing/binlogrouter/blr_slave.cc +++ b/server/modules/routing/binlogrouter/blr_slave.cc @@ -47,6 +47,7 @@ #include #include #include +#include using std::string; using std::vector; @@ -6305,7 +6306,11 @@ static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave } /* Write the packet */ - return MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event); + mxs::RoutingWorker* worker = (mxs::RoutingWorker*)slave->dcb->poll.owner; + worker->execute([slave, h_event]() { + MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event); + }, mxs::RoutingWorker::EXECUTE_AUTO); + return 1; } /**