-
Notifications
You must be signed in to change notification settings - Fork 514
adapter: collect durable object hydration history #38347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 26 commits
79c7cf0
0efe63a
044c053
d7151b9
2ae3c7f
22a9dcc
e97ebaa
7ccf114
4fdae34
b1fe070
b5e8003
fd90638
e52cdd5
237ce44
63bc95a
7b0af29
060f651
fd2048a
1a1bb16
9eb528f
9dbc8dc
23cf89c
3e794ad
065c91a
3c2bdd0
1c3e235
bfe740b
baaf216
c141b38
d4024bb
d3c4350
494a76f
956fe79
949496c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,10 +51,10 @@ impl ActiveComputeSink { | |
| } | ||
|
|
||
| /// Reports the ID of the connection which created the sink. | ||
| pub fn connection_id(&self) -> &ConnectionId { | ||
| pub fn connection_id(&self) -> Option<&ConnectionId> { | ||
| match &self { | ||
| ActiveComputeSink::Subscribe(subscribe) => &subscribe.conn_id, | ||
| ActiveComputeSink::CopyTo(copy_to) => ©_to.conn_id, | ||
| ActiveComputeSink::Subscribe(subscribe) => subscribe.connection_id(), | ||
| ActiveComputeSink::CopyTo(copy_to) => Some(©_to.conn_id), | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -147,13 +147,26 @@ impl SubscribeBacklogAccounting { | |
| } | ||
| } | ||
|
|
||
| /// Ownership and cleanup scope of an active subscribe. | ||
| #[derive(Debug)] | ||
| pub enum ActiveSubscribeOwner { | ||
| /// The subscribe belongs to a SQL session. | ||
| Session { | ||
| conn_id: ConnectionId, | ||
| session_uuid: Uuid, | ||
| }, | ||
| /// The subscribe belongs to a coordinator background task. | ||
| /// | ||
| /// Always `internal`, since there is no session to attribute a | ||
| /// `mz_subscriptions` row to. | ||
| Background, | ||
| } | ||
|
|
||
| /// A description of an active subscribe from coord's perspective | ||
| #[derive(Debug)] | ||
| pub struct ActiveSubscribe { | ||
| /// The ID of the connection which created the subscribe. | ||
| pub conn_id: ConnectionId, | ||
| /// The UUID of the session which created the subscribe. | ||
| pub session_uuid: Uuid, | ||
| /// The owner responsible for retiring the subscribe. | ||
| pub owner: ActiveSubscribeOwner, | ||
| /// The ID of the cluster on which the subscribe is running. | ||
| pub cluster_id: ClusterId, | ||
| /// The IDs of the objects on which the subscribe depends. | ||
|
|
@@ -189,6 +202,33 @@ pub struct ActiveSubscribe { | |
| } | ||
|
|
||
| impl ActiveSubscribe { | ||
| /// The session uuid for this subscribe's `mz_subscriptions` row, or `None` | ||
| /// if it does not appear there. | ||
| pub fn introspection_session_uuid(&self) -> Option<Uuid> { | ||
| match &self.owner { | ||
| ActiveSubscribeOwner::Session { session_uuid, .. } if !self.internal => { | ||
| Some(*session_uuid) | ||
| } | ||
| _ => None, | ||
| } | ||
| } | ||
|
|
||
| /// Returns the owning connection, if this is a session subscribe. | ||
| pub fn connection_id(&self) -> Option<&ConnectionId> { | ||
| match &self.owner { | ||
| ActiveSubscribeOwner::Session { conn_id, .. } => Some(conn_id), | ||
| ActiveSubscribeOwner::Background => None, | ||
| } | ||
| } | ||
|
|
||
| /// Returns the owning session UUID, if this is a session subscribe. | ||
| pub fn session_uuid(&self) -> Option<Uuid> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: no callers;
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Posted by AJ, Aljoscha's coding agent. Removed the unused |
||
| match self.owner { | ||
| ActiveSubscribeOwner::Session { session_uuid, .. } => Some(session_uuid), | ||
| ActiveSubscribeOwner::Background => None, | ||
| } | ||
| } | ||
|
|
||
| /// Initializes the subscription. | ||
| /// | ||
| /// This method must be called exactly once, after constructing an | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pleaes remove this one, we'll remove the lock path so this will rot quickly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posted by AJ, Aljoscha's coding agent.
Removed the section, along with the lock-path wording in the design and implementation comments. The runtime target check remains as the boundary of the coordinator-owned system-maintenance API, without documenting the path being retired.