Skip to content

Commit 5f5815d

Browse files
readyset-adapter: Implement SHOW REPLAY PATHS backend handler
Add handler for SHOW REPLAY PATHS statement that queries the controller's /replay_paths endpoint and formats results as a table with columns: domain, tag, source, destination_index, target_index, path_segments, trigger_type, trigger_index, trigger_source_options. Fixes: REA-6176 Release-Note-Core: Added `SHOW REPLAY PATHS` command to display replay paths in the graph. This is helpful for detailed information about replays and evictions. Change-Id: I362eecb3cd00abc35da7b56b61c6ffaf92c21d80 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/10965 Reviewed-by: Michael Zink <michael.z@readyset.io> Tested-by: Buildkite CI
1 parent 6b3d6c9 commit 5f5815d

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

readyset-adapter/src/backend.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2786,6 +2786,52 @@ where
27862786
))
27872787
}
27882788

2789+
/// Responds to a `SHOW REPLAY PATHS` query
2790+
/// Returns replay paths data as a result set with columns and rows
2791+
async fn show_replay_paths(&mut self) -> ReadySetResult<noria_connector::QueryResult<'static>> {
2792+
// Get replay paths from the controller (already flattened and sorted)
2793+
let replay_paths = self.noria.replay_paths().await?;
2794+
2795+
// Create schema with all columns
2796+
let schema = create_dummy_schema!(
2797+
"domain",
2798+
"tag",
2799+
"source",
2800+
"destination_index",
2801+
"target_index",
2802+
"path",
2803+
"trigger_type",
2804+
"trigger_index",
2805+
"trigger_source_options"
2806+
);
2807+
2808+
// Convert each ReplayPathInfo into a row
2809+
let rows: Vec<Vec<DfValue>> = replay_paths
2810+
.into_iter()
2811+
.map(|info| {
2812+
vec![
2813+
info.domain.to_string().into(),
2814+
info.tag.to_string().into(),
2815+
info.source
2816+
.map(|s| s.to_string())
2817+
.unwrap_or_else(|| "None".to_string())
2818+
.into(),
2819+
info.destination_index.unwrap_or_default().into(),
2820+
info.target_index.unwrap_or_default().into(),
2821+
info.path_segments.join(" → ").into(),
2822+
info.trigger_type.into(),
2823+
info.trigger_index.unwrap_or_default().into(),
2824+
info.trigger_source_options.into(),
2825+
]
2826+
})
2827+
.collect();
2828+
2829+
Ok(noria_connector::QueryResult::from_owned(
2830+
schema,
2831+
vec![Results::new(rows)],
2832+
))
2833+
}
2834+
27892835
async fn query_readyset_extensions<'a>(
27902836
&'a mut self,
27912837
query: &'a SqlQuery,
@@ -3041,6 +3087,7 @@ where
30413087
)
30423088
.await
30433089
}
3090+
SqlQuery::Show(ShowStatement::ReplayPaths) => self.show_replay_paths().await,
30443091
SqlQuery::Show(ShowStatement::Rls(_maybe_table)) => {
30453092
unsupported!("SHOW RLS statement is not yet supported")
30463093
}

readyset-adapter/src/backend/noria_connector.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,12 @@ impl NoriaConnector {
899899
Ok(QueryResult::from_owned(schema, vec![Results::new(data)]))
900900
}
901901

902+
pub(crate) async fn replay_paths(
903+
&mut self,
904+
) -> ReadySetResult<Vec<readyset_client::replay_path::ReplayPathInfo>> {
905+
noria_await!(self.inner, self.inner.noria.replay_paths())
906+
}
907+
902908
/// Set the schema search path
903909
pub fn set_schema_search_path(&mut self, search_path: Vec<SqlIdentifier>) {
904910
self.schema_search_path = search_path;

0 commit comments

Comments
 (0)