Skip to content

Commit

Permalink
Filter out hosts that are OFFLINE_SOFT or OFFLINE_HARD
Browse files Browse the repository at this point in the history
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
  • Loading branch information
altmannmarcelo committed Nov 4, 2024
1 parent b1c14a8 commit a80e710
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/proxysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a80e710

Please sign in to comment.