Skip to content

Commit c782895

Browse files
committed
Route search-path metastore reads to the read replica
Add `ReadReplicaRoutingMetastore`, a `MetastoreService` wrapper that routes the stale-tolerant reads issued by the search and analytics paths (`index_metadata`, `indexes_metadata`, `list_indexes_metadata`, `list_splits`, `list_metrics_splits`, `list_sketch_splits`) to read replica nodes when any are connected, and everything else (writes and non-hot-path reads) to the primary. - Routing is decided per request from the read replica balance channel's live connection set, so it degrades to the primary when no replica is deployed. The check is a synchronous `watch` read with no borrow held across an await. - Wire it into the searcher service and the DataFusion session builder, so all search (REST, Elasticsearch, gRPC) and metrics analytics benefit, while REST admin handlers keep read-your-writes against the primary.
1 parent 80110b7 commit c782895

4 files changed

Lines changed: 471 additions & 2 deletions

File tree

quickwit/quickwit-metastore/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub use metastore::file_backed::FileBackedMetastore;
4242
pub(crate) use metastore::index_metadata::serialize::{IndexMetadataV0_8, VersionedIndexMetadata};
4343
#[cfg(feature = "postgres")]
4444
pub use metastore::postgres::PostgresqlMetastore;
45+
pub use metastore::read_replica_routing_metastore::ReadReplicaRoutingMetastore;
4546
pub use metastore::{
4647
AddSourceRequestExt, CreateIndexRequestExt, CreateIndexResponseExt, IndexMetadata,
4748
IndexMetadataResponseExt, IndexesMetadataResponseExt, ListIndexesMetadataResponseExt,

quickwit/quickwit-metastore/src/metastore/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub(crate) mod index_metadata;
1818
pub mod postgres;
1919

2020
pub mod control_plane_metastore;
21+
pub mod read_replica_routing_metastore;
2122

2223
use std::cmp::Ordering;
2324
use std::ops::{Bound, RangeInclusive};

0 commit comments

Comments
 (0)