Statement timeout + replica imbalance fix (#122)

* Statement timeout

* send error message too

* Correct error messages

* Fix replica inbalance

* disable stmt timeout by default

* Redundant mark_bad

* revert healthcheck delay

* tests

* set it to 0

* reload config again
This commit is contained in:
Lev Kokotov
2022-08-13 13:45:58 -07:00
committed by GitHub
parent 52303cc808
commit 3285006440
6 changed files with 77 additions and 7 deletions

View File

@@ -100,6 +100,7 @@ pub struct User {
pub username: String,
pub password: String,
pub pool_size: u32,
pub statement_timeout: u64,
}
impl Default for User {
@@ -108,6 +109,7 @@ impl Default for User {
username: String::from("postgres"),
password: String::new(),
pool_size: 15,
statement_timeout: 0,
}
}
}
@@ -332,6 +334,7 @@ impl Config {
};
for (pool_name, pool_config) in &self.pools {
// TODO: Make this output prettier (maybe a table?)
info!("--- Settings for pool {} ---", pool_name);
info!(
"Pool size from all users: {}",
@@ -346,8 +349,17 @@ impl Config {
info!("Sharding function: {}", pool_config.sharding_function);
info!("Primary reads: {}", pool_config.primary_reads_enabled);
info!("Query router: {}", pool_config.query_parser_enabled);
// TODO: Make this prettier.
info!("Number of shards: {}", pool_config.shards.len());
info!("Number of users: {}", pool_config.users.len());
for user in &pool_config.users {
info!(
"{} pool size: {}, statement timeout: {}",
user.1.username, user.1.pool_size, user.1.statement_timeout
);
}
}
}
}