From a80e71034b25521fd0eef3a84efb8bd2e7365209 Mon Sep 17 00:00:00 2001 From: Marcelo Altmann Date: Mon, 4 Nov 2024 14:12:57 -0300 Subject: [PATCH] Filter out hosts that are OFFLINE_SOFT or OFFLINE_HARD If a user wants to gracefully remove a host from proxysql, it will change the status to OFFLINE_SOFT, wait it to complete all the current ongoing connections and then change it to OFFLINE_HARD. The scheduler should not consider those hosts as available to be used and filter them out. Fixes: #25 --- src/proxysql.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proxysql.rs b/src/proxysql.rs index b979931..484507e 100644 --- a/src/proxysql.rs +++ b/src/proxysql.rs @@ -39,7 +39,7 @@ impl ProxySQL { .expect("Failed to create ProxySQL connection"); let query = format!( - "SELECT hostname, port, status, comment FROM mysql_servers WHERE hostgroup_id = {}", + "SELECT hostname, port, status, comment FROM mysql_servers WHERE hostgroup_id = {} AND status IN ('ONLINE', 'SHUNNED')", config.readyset_hostgroup ); let results: Vec<(String, u16, String, String)> = conn.query(query).unwrap();