From 52f206d36cb0d57eee158b207bface971d53a67a Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Mon, 25 Sep 2023 14:50:12 +0200 Subject: [PATCH] Added writer_hostgroup in duplicate check.\n Added INSERT OR IGNORE on mysql_server_galera_log table. --- lib/MySQL_Monitor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 371f7d2098..f0db67eafa 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -5265,7 +5265,7 @@ void MySQL_Monitor::populate_monitor_mysql_server_galera_log() { int rc; //char *query=NULL; char *query1=NULL; - query1=(char *)"INSERT INTO mysql_server_galera_log VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)"; + query1=(char *)"INSERT OR IGNORE INTO mysql_server_galera_log VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)"; sqlite3_stmt *statement1=NULL; pthread_mutex_lock(&GloMyMon->galera_mutex); //rc=(*proxy_sqlite3_prepare_v2)(mondb, query1, -1, &statement1, 0); @@ -8022,8 +8022,8 @@ void MySQL_Monitor::monitor_galera_async() { for (std::vector::iterator it = Galera_Hosts_resultset->rows.begin(); it != Galera_Hosts_resultset->rows.end(); ++it) { const SQLite3_row* r = *it; - - auto ret = checked_servers.insert(std::string(r->fields[1]) + ":" + std::string(r->fields[2])); + // r->fields[0] = writer_hostgroup, r->fields[1] = hostname, r->fields[2] = port + auto ret = checked_servers.insert(std::string(r->fields[0]) + ":" + std::string(r->fields[1]) + ":" + std::string(r->fields[2])); if (ret.second == false) // duplicate server entry continue;