@ -5142,11 +5142,15 @@ void MySQL_HostGroups_Manager::update_galera_set_offline(char *_hostname, int _p
q=(char*)"INSERT OR REPLACE INTO mysql_servers_incoming SELECT %d, hostname, port, gtid_port, weight, 0, compression, max_connections, max_replication_lag, use_ssl, max_latency_ms, comment FROM mysql_servers_incoming WHERE hostname='%s' AND port=%d AND hostgroup_id in (%d, %d, %d)";
// any current reader which is only in the reader hostgroup. This is because if a server
// is only part of the reader hostgroup at this point, means that it's there because of a
// reason beyond ProxySQL control, e.g. having READ_ONLY=1.
q=(char*)"DELETE FROM mysql_servers_incoming where hostgroup_id=%d and (hostname,port) in (SELECT hostname,port FROM mysql_servers_incoming WHERE hostgroup_id=%d)";
// Update for #3182:
// We just want to remove 'readers' which are 'ONLINE' right now, otherwise,
// we could be removing the introduced 'SHUNNED' readers, placed there by an 'offline soft'
// operation.
q=(char*)"DELETE FROM mysql_servers_incoming where hostgroup_id=%d and (hostname,port) in (SELECT hostname,port FROM mysql_servers_incoming WHERE hostgroup_id=%d AND status=0)";