feat: introduce read preference (#5783)

* feat: introduce read preference

* feat: introduce `RegionQueryHandlerFactory`

* feat: extract ReadPreference from http header

* test: add more tests

* chore: apply suggestions from CR

* chore: apply suggestions from CR
This commit is contained in:
Weny Xu
2025-04-01 17:17:01 +08:00
committed by GitHub
parent f9221e9e66
commit 4ef9afd8d8
26 changed files with 311 additions and 17 deletions

View File

@@ -20,6 +20,7 @@ datatypes.workspace = true
itertools.workspace = true
serde.workspace = true
serde_json.workspace = true
session.workspace = true
snafu.workspace = true
sql.workspace = true
sqlparser.workspace = true

View File

@@ -171,6 +171,7 @@ impl PartitionRuleManager {
Ok(Arc::new(rule) as _)
}
/// Find the leader of the region.
pub async fn find_region_leader(&self, region_id: RegionId) -> Result<Peer> {
let region_routes = &self
.find_physical_table_route(region_id.table_id())