From f762929c94f3ba4a82658fa0503e14606ec7d6da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20del=20Campo?= Date: Thu, 27 Dec 2018 16:40:24 +0100 Subject: [PATCH] Fixed query to get available galera nodes in a hostgroup --- lib/MySQL_HostGroups_Manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 51085949a..038e0c31c 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -3697,8 +3697,8 @@ void MySQL_HostGroups_Manager::update_galera_set_offline(char *_hostname, int _p } else { // the server is already offline, but we check if needs to be taken back online SQLite3_result *numw_result = NULL; q=(char *)"SELECT 1 FROM mysql_servers WHERE hostgroup_id=%d AND status=0"; - query=(char *)malloc(strlen(q)+strlen(_hostname)+32); - sprintf(query,q,_hostname,_port); + query=(char *)malloc(strlen(q) + (sizeof(_writer_hostgroup) * 8 + 1)); + sprintf(query,q,_writer_hostgroup); mydb->execute_statement(query, &error , &cols , &affected_rows , &numw_result); free(query); if (numw_result) {