Allocate blr heartbeat buffer on correct worker
The buffer was allocated on one worker and written on another.
This commit is contained in:
parent
788dc429f8
commit
59f2145c00
@ -243,7 +243,7 @@ static int blr_slave_send_columndef_with_status_schema(ROUTER_INSTANCE* router,
|
||||
int len,
|
||||
uint8_t seqno);
|
||||
static bool blr_send_slave_heartbeat(void* inst);
|
||||
static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router,
|
||||
static void blr_slave_send_heartbeat(ROUTER_INSTANCE* router,
|
||||
ROUTER_SLAVE* slave);
|
||||
static int blr_set_master_ssl(ROUTER_INSTANCE* router,
|
||||
const ChangeMasterConfig& config,
|
||||
@ -6204,13 +6204,11 @@ static bool blr_send_slave_heartbeat(void* inst)
|
||||
sptr->heartbeat,
|
||||
(unsigned long)sptr->lastReply);
|
||||
|
||||
if (blr_slave_send_heartbeat(router, sptr))
|
||||
{
|
||||
/* Set last event */
|
||||
sptr->lastEventReceived = HEARTBEAT_EVENT;
|
||||
/* Set last time */
|
||||
sptr->lastReply = t_now;
|
||||
}
|
||||
blr_slave_send_heartbeat(router, sptr);
|
||||
/* Set last event */
|
||||
sptr->lastEventReceived = HEARTBEAT_EVENT;
|
||||
/* Set last time */
|
||||
sptr->lastReply = t_now;
|
||||
}
|
||||
|
||||
sptr = sptr->next;
|
||||
@ -6228,7 +6226,7 @@ static bool blr_send_slave_heartbeat(void* inst)
|
||||
* @param slave The current slave connection
|
||||
* @return Number of bytes sent or 0 in case of failure
|
||||
*/
|
||||
static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
||||
static void send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
||||
{
|
||||
REP_HEADER hdr;
|
||||
GWBUF* h_event;
|
||||
@ -6255,10 +6253,7 @@ static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave
|
||||
*
|
||||
* Total = 5 bytes + len
|
||||
*/
|
||||
if ((h_event = gwbuf_alloc(MYSQL_HEADER_LEN + 1 + len)) == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
h_event = gwbuf_alloc(MYSQL_HEADER_LEN + 1 + len);
|
||||
|
||||
/* The OK/Err byte is part of payload */
|
||||
hdr.payload_len = len + 1;
|
||||
@ -6306,11 +6301,15 @@ static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave
|
||||
}
|
||||
|
||||
/* Write the packet */
|
||||
MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event);
|
||||
}
|
||||
|
||||
static void blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
||||
{
|
||||
mxs::RoutingWorker* worker = (mxs::RoutingWorker*)slave->dcb->poll.owner;
|
||||
worker->execute([slave, h_event]() {
|
||||
MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event);
|
||||
worker->execute([router, slave]() {
|
||||
send_heartbeat(router, slave);
|
||||
}, mxs::RoutingWorker::EXECUTE_AUTO);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user