Merge branch '2.3' into develop

This commit is contained in:
Johan Wikman
2019-05-09 14:35:44 +03:00
3 changed files with 38 additions and 32 deletions

View File

@ -277,37 +277,41 @@ void GaleraMonitor::update_server_status(MonitorServer* monitored_server)
/* Node is in desync - lets take it offline */ /* Node is in desync - lets take it offline */
if (strcmp(row[0], "wsrep_desync") == 0) if (strcmp(row[0], "wsrep_desync") == 0)
{ {
if (strcasecmp(row[1],"YES") || strcasecmp(row[1],"ON") || strcasecmp(row[1],"1") || strcasecmp(row[1],"true")) if (strcasecmp(row[1], "YES") == 0 || strcasecmp(row[1], "ON") == 0
{ || strcasecmp(row[1], "1") == 0 || strcasecmp(row[1], "true") == 0)
info.joined = 0; {
} info.joined = 0;
}
} }
/* Node rejects queries - lets take it offline */ /* Node rejects queries - lets take it offline */
if (strcmp(row[0], "wsrep_reject_queries") == 0) if (strcmp(row[0], "wsrep_reject_queries") == 0)
{ {
if (strcasecmp(row[1],"ALL") || strcasecmp(row[1],"ALL_KILL")) if (strcasecmp(row[1], "ALL") == 0
{ || strcasecmp(row[1], "ALL_KILL") == 0)
info.joined = 0; {
} info.joined = 0;
}
} }
/* Node rejects queries - lets take it offline */ /* Node rejects queries - lets take it offline */
if (strcmp(row[0], "wsrep_sst_donor_rejects_queries") == 0) if (strcmp(row[0], "wsrep_sst_donor_rejects_queries") == 0)
{ {
if (strcasecmp(row[1],"YES") || strcasecmp(row[1],"ON") || strcasecmp(row[1],"1") || strcasecmp(row[1],"true")) if (strcasecmp(row[1], "YES") == 0 || strcasecmp(row[1], "ON") == 0
{ || strcasecmp(row[1], "1") == 0 || strcasecmp(row[1], "true") == 0)
info.joined = 0; {
} info.joined = 0;
}
} }
/* Node is not ready - lets take it offline */ /* Node is not ready - lets take it offline */
if (strcmp(row[0], "wsrep_ready") == 0) if (strcmp(row[0], "wsrep_ready") == 0)
{ {
if (strcasecmp(row[1],"NO") || strcasecmp(row[1],"OFF") || strcasecmp(row[1],"0") || strcasecmp(row[1],"false")) if (strcasecmp(row[1], "NO") == 0 || strcasecmp(row[1], "OFF") == 0
{ || strcasecmp(row[1], "0") == 0 || strcasecmp(row[1], "false") == 0)
info.joined = 0; {
} info.joined = 0;
}
} }
if (strcmp(row[0], "wsrep_cluster_state_uuid") == 0 && row[1] && *row[1]) if (strcmp(row[0], "wsrep_cluster_state_uuid") == 0 && row[1] && *row[1])

View File

@ -243,7 +243,7 @@ bool file_in_dir(const char* dir, const char* file)
*/ */
void AvroSession::queue_client_callback() void AvroSession::queue_client_callback()
{ {
auto worker = mxs::RoutingWorker::get(mxs::RoutingWorker::MAIN); auto worker = static_cast<mxs::RoutingWorker*>(dcb->owner);
worker->execute([this]() { worker->execute([this]() {
client_callback(); client_callback();
}, mxs::RoutingWorker::EXECUTE_QUEUED); }, mxs::RoutingWorker::EXECUTE_QUEUED);

View File

@ -242,7 +242,7 @@ static int blr_slave_send_columndef_with_status_schema(ROUTER_INSTANCE* router,
int len, int len,
uint8_t seqno); uint8_t seqno);
static bool blr_send_slave_heartbeat(void* inst); 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); ROUTER_SLAVE* slave);
static int blr_set_master_ssl(ROUTER_INSTANCE* router, static int blr_set_master_ssl(ROUTER_INSTANCE* router,
const ChangeMasterConfig& config, const ChangeMasterConfig& config,
@ -6205,13 +6205,11 @@ static bool blr_send_slave_heartbeat(void* inst)
sptr->heartbeat, sptr->heartbeat,
(unsigned long)sptr->lastReply); (unsigned long)sptr->lastReply);
if (blr_slave_send_heartbeat(router, sptr)) blr_slave_send_heartbeat(router, sptr);
{ /* Set last event */
/* Set last event */ sptr->lastEventReceived = HEARTBEAT_EVENT;
sptr->lastEventReceived = HEARTBEAT_EVENT; /* Set last time */
/* Set last time */ sptr->lastReply = t_now;
sptr->lastReply = t_now;
}
} }
sptr = sptr->next; sptr = sptr->next;
@ -6229,7 +6227,7 @@ static bool blr_send_slave_heartbeat(void* inst)
* @param slave The current slave connection * @param slave The current slave connection
* @return Number of bytes sent or 0 in case of failure * @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; REP_HEADER hdr;
GWBUF* h_event; GWBUF* h_event;
@ -6256,10 +6254,7 @@ static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave
* *
* Total = 5 bytes + len * Total = 5 bytes + len
*/ */
if ((h_event = gwbuf_alloc(MYSQL_HEADER_LEN + 1 + len)) == NULL) h_event = gwbuf_alloc(MYSQL_HEADER_LEN + 1 + len);
{
return 0;
}
/* The OK/Err byte is part of payload */ /* The OK/Err byte is part of payload */
hdr.payload_len = len + 1; hdr.payload_len = len + 1;
@ -6307,11 +6302,18 @@ static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave
} }
/* Write the packet */ /* Write the packet */
mxs::RoutingWorker* worker = (mxs::RoutingWorker*)slave->dcb->owner; mxs::RoutingWorker* worker = static_cast<mxs::RoutingWorker*>(slave->dcb->owner);
worker->execute([slave, h_event]() { worker->execute([slave, h_event]() {
MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event); MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event);
}, mxs::RoutingWorker::EXECUTE_AUTO); }, mxs::RoutingWorker::EXECUTE_AUTO);
return 1; }
static void blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
{
mxs::RoutingWorker* worker = static_cast<mxs::RoutingWorker*>(slave->dcb->owner);
worker->execute([router, slave]() {
send_heartbeat(router, slave);
}, mxs::RoutingWorker::EXECUTE_AUTO);
} }
/** /**