-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commits implement mode of operation, allowing users to instruct scheduler to operate in health check mode, query discovery mode or both. Closes #9
- Loading branch information
1 parent
3778ccf
commit bc50868
Showing
5 changed files
with
120 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::{ | ||
config, messages, | ||
server::{self, ServerStatus}, | ||
}; | ||
|
||
pub fn health_check( | ||
proxysql_conn: &mut mysql::PooledConn, | ||
config: &config::Config, | ||
readyset_conn: &mut mysql::PooledConn, | ||
) { | ||
match server::check_readyset_is_ready(readyset_conn) { | ||
Ok(ready) => { | ||
if ready { | ||
let _ = server::change_server_status(proxysql_conn, config, ServerStatus::Online); | ||
} else { | ||
messages::print_info("Readyset is still running Snapshot."); | ||
let _ = server::change_server_status(proxysql_conn, config, ServerStatus::Shunned); | ||
std::process::exit(0); | ||
} | ||
} | ||
Err(e) => { | ||
messages::print_error(format!("Cannot check Readyset status: {}.", e).as_str()); | ||
let _ = server::change_server_status(proxysql_conn, config, ServerStatus::Shunned); | ||
std::process::exit(1); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters