Fix default_role being ignored when query_parser_enabled was false

This commit is contained in:
Jose Fernandez (magec)
2024-11-05 13:45:05 +01:00
parent a68071dd28
commit c098c54670
3 changed files with 41 additions and 1 deletions

View File

@@ -881,6 +881,7 @@ where
};
query_router.update_pool_settings(&pool.settings);
query_router.set_default_role();
// Our custom protocol loop.
// We expect the client to either start a transaction with regular queries

View File

@@ -1061,6 +1061,11 @@ impl QueryRouter {
self.active_shard
}
/// Set active_role as the default_role specified in the pool.
pub fn set_default_role(&mut self) {
self.active_role = self.pool_settings.default_role;
}
/// Get the current desired server role we should be talking to.
pub fn role(&self) -> Option<Role> {
self.active_role