diff --git a/server/modules/monitor/galeramon/galeramon.cc b/server/modules/monitor/galeramon/galeramon.cc index 8c41dc020..b62a013c3 100644 --- a/server/modules/monitor/galeramon/galeramon.cc +++ b/server/modules/monitor/galeramon/galeramon.cc @@ -277,37 +277,41 @@ void GaleraMonitor::update_server_status(MonitorServer* monitored_server) /* Node is in desync - lets take it offline */ if (strcmp(row[0], "wsrep_desync") == 0) { - if (strcasecmp(row[1],"YES") || strcasecmp(row[1],"ON") || strcasecmp(row[1],"1") || strcasecmp(row[1],"true")) - { - info.joined = 0; - } + if (strcasecmp(row[1], "YES") == 0 || strcasecmp(row[1], "ON") == 0 + || strcasecmp(row[1], "1") == 0 || strcasecmp(row[1], "true") == 0) + { + info.joined = 0; + } } /* Node rejects queries - lets take it offline */ if (strcmp(row[0], "wsrep_reject_queries") == 0) { - if (strcasecmp(row[1],"ALL") || strcasecmp(row[1],"ALL_KILL")) - { - info.joined = 0; - } + if (strcasecmp(row[1], "ALL") == 0 + || strcasecmp(row[1], "ALL_KILL") == 0) + { + info.joined = 0; + } } /* Node rejects queries - lets take it offline */ 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")) - { - info.joined = 0; - } + if (strcasecmp(row[1], "YES") == 0 || strcasecmp(row[1], "ON") == 0 + || strcasecmp(row[1], "1") == 0 || strcasecmp(row[1], "true") == 0) + { + info.joined = 0; + } } /* Node is not ready - lets take it offline */ if (strcmp(row[0], "wsrep_ready") == 0) { - if (strcasecmp(row[1],"NO") || strcasecmp(row[1],"OFF") || strcasecmp(row[1],"0") || strcasecmp(row[1],"false")) - { - info.joined = 0; - } + if (strcasecmp(row[1], "NO") == 0 || strcasecmp(row[1], "OFF") == 0 + || strcasecmp(row[1], "0") == 0 || strcasecmp(row[1], "false") == 0) + { + info.joined = 0; + } } if (strcmp(row[0], "wsrep_cluster_state_uuid") == 0 && row[1] && *row[1]) diff --git a/server/modules/routing/avrorouter/avro_client.cc b/server/modules/routing/avrorouter/avro_client.cc index 9d725f5a5..91c38b9a1 100644 --- a/server/modules/routing/avrorouter/avro_client.cc +++ b/server/modules/routing/avrorouter/avro_client.cc @@ -243,7 +243,7 @@ bool file_in_dir(const char* dir, const char* file) */ void AvroSession::queue_client_callback() { - auto worker = mxs::RoutingWorker::get(mxs::RoutingWorker::MAIN); + auto worker = static_cast(dcb->owner); worker->execute([this]() { client_callback(); }, mxs::RoutingWorker::EXECUTE_QUEUED); diff --git a/server/modules/routing/binlogrouter/blr_slave.cc b/server/modules/routing/binlogrouter/blr_slave.cc index 3aa5a6fd3..612d283b4 100644 --- a/server/modules/routing/binlogrouter/blr_slave.cc +++ b/server/modules/routing/binlogrouter/blr_slave.cc @@ -242,7 +242,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, @@ -6205,13 +6205,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; @@ -6229,7 +6227,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; @@ -6256,10 +6254,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; @@ -6307,11 +6302,18 @@ static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave } /* Write the packet */ - mxs::RoutingWorker* worker = (mxs::RoutingWorker*)slave->dcb->owner; + mxs::RoutingWorker* worker = static_cast(slave->dcb->owner); worker->execute([slave, h_event]() { MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event); }, mxs::RoutingWorker::EXECUTE_AUTO); - return 1; +} + +static void blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave) +{ + mxs::RoutingWorker* worker = static_cast(slave->dcb->owner); + worker->execute([router, slave]() { + send_heartbeat(router, slave); + }, mxs::RoutingWorker::EXECUTE_AUTO); } /**