From 43d627406056fb30a52018925b94bd7c4454a29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Mon, 10 Jul 2023 14:34:39 +0200 Subject: [PATCH] Fix servers resultsets not updated for empty config If these resultsets are not updated, checksums will always mismatch between the peer cluster nodes in case servers are deleted. The primary will hold the correct checksum ('0x0'), but will report the old resultset to the peer node, the second will compute a checksum different than the expected '0x0'. Cycle won't stop until config is updated in the target primary. --- lib/MySQL_HostGroups_Manager.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 823dcab68..216288bfd 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -2306,12 +2306,8 @@ uint64_t MySQL_HostGroups_Manager::get_mysql_servers_checksum(SQLite3_result* ru resultset->rows.end() ); resultset->rows_count = init_row_count - rm_rows_count; - - save_runtime_mysql_servers(resultset); - } else { - delete resultset; - resultset = nullptr; } + save_runtime_mysql_servers(resultset); } else { proxy_info("Checksum for table %s is 0x%lX\n", "mysql_servers", (long unsigned int)0); } @@ -2367,11 +2363,8 @@ uint64_t MySQL_HostGroups_Manager::get_mysql_servers_v2_checksum(SQLite3_result* ); resultset->rows_count = init_row_count - rm_rows_count; - save_mysql_servers_v2(resultset); - } else { - delete resultset; - resultset = nullptr; } + save_mysql_servers_v2(resultset); } else { proxy_info("Checksum for table %s is 0x%lX\n", "mysql_servers_v2", (long unsigned int)0); } @@ -8335,4 +8328,4 @@ uint64_t MySQL_HostGroups_Manager::compute_mysql_servers_raw_checksum(const SQLi myhash.Final(&res_hash, &hash2); return res_hash; -} \ No newline at end of file +}