MXS-1367: Take mxs_mysql_query into use

The use of a wrapper function allows automated retrying of the queries
without requiring any changes to the code that uses it.
This commit is contained in:
Markus Mäkelä
2017-10-03 01:52:54 +03:00
parent f1f8a4b5b2
commit 67ef7bd058
8 changed files with 50 additions and 45 deletions

View File

@ -38,6 +38,7 @@
#include "galeramon.h"
#include <maxscale/dcb.h>
#include <maxscale/alloc.h>
#include <maxscale/mysql_utils.h>
#define DONOR_NODE_NAME_MAX_LEN 60
#define DONOR_LIST_SET_VAR "SET GLOBAL wsrep_sst_donor = \""
@ -269,7 +270,7 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITOR_SERVERS *database)
}
/* Check if the the Galera FSM shows this node is joined to the cluster */
if (mysql_query(database->con, "SHOW STATUS LIKE 'wsrep_local_state'") == 0
if (mxs_mysql_query(database->con, "SHOW STATUS LIKE 'wsrep_local_state'") == 0
&& (result = mysql_store_result(database->con)) != NULL)
{
if (mysql_field_count(database->con) < 2)
@ -290,7 +291,7 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITOR_SERVERS *database)
/* Check if the node is a donor and is using xtrabackup, in this case it can stay alive */
else if (strcmp(row[1], "2") == 0 && handle->availableWhenDonor == 1)
{
if (mysql_query(database->con, "SHOW VARIABLES LIKE 'wsrep_sst_method'") == 0
if (mxs_mysql_query(database->con, "SHOW VARIABLES LIKE 'wsrep_sst_method'") == 0
&& (result2 = mysql_store_result(database->con)) != NULL)
{
if (mysql_field_count(database->con) < 2)
@ -327,7 +328,7 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITOR_SERVERS *database)
if (isjoined)
{
/* Check the the Galera node index in the cluster */
if (mysql_query(database->con, "SHOW STATUS LIKE 'wsrep_local_index'") == 0
if (mxs_mysql_query(database->con, "SHOW STATUS LIKE 'wsrep_local_index'") == 0
&& (result = mysql_store_result(database->con)) != NULL)
{
if (mysql_field_count(database->con) < 2)
@ -772,7 +773,7 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
MXS_MONITOR_SERVERS *ptr = node_list[k];
/* Get the Galera node name */
if (mysql_query(ptr->con, "SHOW VARIABLES LIKE 'wsrep_node_name'") == 0
if (mxs_mysql_query(ptr->con, "SHOW VARIABLES LIKE 'wsrep_node_name'") == 0
&& (result = mysql_store_result(ptr->con)) != NULL)
{
if (mysql_field_count(ptr->con) < 2)
@ -817,7 +818,7 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
{
MXS_MONITOR_SERVERS *ptr = node_list[k];
/* Set the Galera SST donor node list */
if (mysql_query(ptr->con, donor_list) == 0)
if (mxs_mysql_query(ptr->con, donor_list) == 0)
{
MXS_DEBUG("SET GLOBAL rep_sst_donor OK in node %s",
ptr->server->unique_name);