Skip to content

Commit de3cc36

Browse files
salman1993claude
andcommitted
feat(search): pick the search backend per relay and shadow-compare OpenSearch
The integer flag search.backend holds one value for the whole relay: 0 answers from Postgres, 1 also runs the same first-page query on OpenSearch and only compares and measures it, 2 answers from OpenSearch. A relay never serves some communities from one backend and some from the other. With LaunchDarkly a change applies within seconds, which is the rollback. Searches that name no message kind stay on Postgres at every value. At 2 a failed OpenSearch search fails the request; nothing falls back. Metrics and the shadow log line never carry query text. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Salman Mohammed <smohammed@squareup.com>
1 parent a08a5f0 commit de3cc36

13 files changed

Lines changed: 1612 additions & 41 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/buzz-relay/src/feature_flags.rs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ impl FeatureFlags {
140140
self.evaluator.as_ref()
141141
}
142142

143+
/// A handle to the shared evaluator, for consumers that outlive a borrow
144+
/// (the search service reads `search.backend` on every search).
145+
pub fn shared_evaluator(&self) -> Arc<dyn FlagEvaluator> {
146+
Arc::clone(&self.evaluator)
147+
}
148+
143149
/// Report provider health after a round of evaluations: log malformed
144150
/// environment values once each, and publish whether the provider has
145151
/// initialized (`buzz_feature_flags_ready`). It does not track the

‎crates/buzz-relay/src/handlers/mod.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ pub mod report;
6767
pub mod report_resolution;
6868
/// REQ handler — subscribe, deliver historical events, then EOSE.
6969
pub mod req;
70+
#[cfg(test)]
71+
mod search_backend_postgres_tests;
7072
/// NIP-29 and NIP-25 side-effect handlers.
7173
pub mod side_effects;
7274
mod solo_member_role;

0 commit comments

Comments
 (0)