Skip to content

Commit 062429b

Browse files
Add service protocol version in SQL shell for sys_deployment and sys_invocation (restatedev#2093)
1 parent ec5c864 commit 062429b

File tree

6 files changed

+32
-0
lines changed

6 files changed

+32
-0
lines changed

crates/storage-query-datafusion/src/context.rs

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const SYS_INVOCATION_VIEW: &str = "CREATE VIEW sys_invocation as SELECT
4646
ss.invoked_by_id,
4747
ss.invoked_by_target,
4848
ss.pinned_deployment_id,
49+
ss.pinned_service_protocol_version,
4950
ss.trace_id,
5051
ss.journal_size,
5152
ss.created_at,

crates/storage-query-datafusion/src/deployment/row.rs

+14
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,18 @@ pub(crate) fn append_deployment_row(
3232

3333
row.endpoint(format_using(output, &deployment.metadata.address_display()));
3434
row.created_at(deployment.metadata.created_at.as_u64() as i64);
35+
row.min_service_protocol_version(
36+
deployment
37+
.metadata
38+
.supported_protocol_versions
39+
.start()
40+
.unsigned_abs(),
41+
);
42+
row.max_service_protocol_version(
43+
deployment
44+
.metadata
45+
.supported_protocol_versions
46+
.end()
47+
.unsigned_abs(),
48+
);
3549
}

crates/storage-query-datafusion/src/deployment/schema.rs

+6
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@ define_table!(sys_deployment(
2626

2727
/// Timestamp indicating the deployment registration time.
2828
created_at: DataType::Date64,
29+
30+
/// Minimum supported protocol version.
31+
min_service_protocol_version: DataType::UInt32,
32+
33+
/// Maximum supported protocol version.
34+
max_service_protocol_version: DataType::UInt32
2935
));

crates/storage-query-datafusion/src/invocation_status/row.rs

+6
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ fn fill_in_flight_invocation_metadata(
110110
// journal_metadata and stats are filled by other functions
111111
if let Some(pinned_deployment) = meta.pinned_deployment {
112112
row.pinned_deployment_id(pinned_deployment.deployment_id.to_string());
113+
row.pinned_service_protocol_version(
114+
pinned_deployment
115+
.service_protocol_version
116+
.as_repr()
117+
.unsigned_abs(),
118+
);
113119
}
114120
fill_invoked_by(row, output, meta.source)
115121
}

crates/storage-query-datafusion/src/invocation_status/schema.rs

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ define_table!(sys_invocation_status(
6767
/// this invocation.
6868
pinned_deployment_id: DataType::LargeUtf8,
6969

70+
/// The negotiated protocol version used for this invocation.
71+
/// This gets set after the first journal entry has been stored for this invocation.
72+
pinned_service_protocol_version: DataType::UInt32,
73+
7074
/// The ID of the trace that is assigned to this invocation. Only relevant when tracing is
7175
/// enabled.
7276
trace_id: DataType::LargeUtf8,

crates/storage-query-datafusion/src/table_docs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ pub fn sys_invocation_table_docs() -> OwnedTableDocs {
101101
sys_invocation_status.remove("invoked_by_id").expect("invoked_by_id should exist"),
102102
sys_invocation_status.remove("invoked_by_target").expect("invoked_by_target should exist"),
103103
sys_invocation_status.remove("pinned_deployment_id").expect("pinned_deployment_id should exist"),
104+
sys_invocation_status.remove("pinned_service_protocol_version").expect("pinned_service_protocol_version should exist"),
104105
sys_invocation_status.remove("trace_id").expect("trace_id should exist"),
105106
sys_invocation_status.remove("journal_size").expect("journal_size should exist"),
106107
sys_invocation_status.remove("created_at").expect("created_at should exist"),

0 commit comments

Comments
 (0)