Skip to content

Commit c1c231b

Browse files
committed
Address comments on lifecycle design doc
1 parent d3a52ab commit c1c231b

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

doc/developer/design/20250515_query_lifecycle_extensions.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Extending the Query Lifecycle Tables
22

3-
- Associated: [#9140](https://github.com/MaterializeInc/database-issues/issues/9140)
3+
Associated:
4+
- [#9140](https://github.com/MaterializeInc/database-issues/issues/9140)
5+
- [Original statement logging design doc](https://github.com/MaterializeInc/materialize/blob/4487749289f1591e7918ebaa1458e23b5e40633f/doc/developer/design/20230519_statement_logging.md)
6+
- [Original statement lifecycle design doc](https://github.com/MaterializeInc/materialize/blob/4487749289f1591e7918ebaa1458e23b5e40633f/doc/developer/design/20231204_query_lifecycle_events_logging.md)
47

58
## The Problem
69

@@ -57,11 +60,11 @@ So, what I would propose is:
5760
- multiple queries in 2., in which case, again, the same lifecycle event would be copied to multiple statements.
5861
- a `PREPARE` in 3.
5962
- a `Parse` in 4.
60-
- `ParsingComplete`: when our parsing finishes in `protocol.rs`. (This is in 1-to-1 correspondence with `StatementReceived`.) Note that this is not the entire handling of a `Parse` msg of 4., but only the actual parsing.
61-
- `PrepareComplete`: when we have finished the preparations for a statement. (This is in 1-to-1 correspondence with `StatementReceived`.) More specifically:
63+
- `ParsingFinished`: when our parsing finishes in `protocol.rs`. (This is in 1-to-1 correspondence with `StatementReceived`.) Note that this is not the entire handling of a `Parse` msg of 4., but only the actual parsing.
64+
- `PrepareFinished`: when we have finished the preparations for a statement. (This is in 1-to-1 correspondence with `StatementReceived`.) More specifically:
6265
- For 1. and 2., when `one_query` is about to call `adapter_client.execute`.
6366
- For 3., when a `PREPARE` completes, i.e., when we are about to send the response to the user in `protocol.rs`.
64-
- For 4., when we are about to send a `ParseComplete` back to the user in `protocol.rs`.
67+
- For 4., when we are about to send a `ParseFinished` back to the user in `protocol.rs`.
6568
- Additionally, we should have ...received and ...finished events for each of the other msgs in the "Extended Query" flow, e.g., `Bind`, `Describe`, `Execute`.
6669

6770
Note that if a user is interested only in queries submitted through 1. or 2., and they are not interested in when the parsing and other preparation ended, it will be enough to look at `mz_statement_execution_lifecycle_history` (and optionally join it with `mz_statement_execution_history` and `mz_prepared_statement_history` to get more info about the execution and/or statement). They will still be able to get the end-to-end time, because `ExecutionMessageReceived` will be part of `mz_statement_execution_lifecycle_history`.
@@ -76,27 +79,27 @@ For a query submitted through 1.:
7679
- `FrontendMessage::Query` arrives in `protocol.rs`, to which
7780
- `mz_statement_lifecycle_history` would get the following events:
7881
- `StatementReceived`
79-
- `ParsingComplete`
80-
- `PrepareComplete`
82+
- `ParsingFinished`
83+
- `PrepareFinished`
8184
- `mz_statement_execution_lifecycle_history` would get the following events:
8285
- `ExecutionMessageReceived` (roughly corresponds to last byte of the query arriving) (with the same timestamp as the above `StatementReceived`)
8386
- `ExecutionBegan` (already exists, emitted in the Coordinator's `begin_statement_execution`)
8487
- `OptimizationStarted` (new event, but not mentioned above, because it's orthogonal to the prepared statement issues) (this should be very close in time to `ExecutionBegan` if things are behaving correctly, but I have a suspicion that this is not always the case)
8588
- `OptimizationFinished` (already exists)
86-
- `StorageDependenciesFinished`
87-
- `ComputeDependenciesFinished`
89+
- `StorageDependenciesFinished` (already exists)
90+
- `ComputeDependenciesFinished` (already exists)
8891
- `ExecutionFinished` (roughly corresponds to first byte of the result sent to user)
8992

9093
For a query submitted through 4.:
9194
- `FrontendMessage::Parse` arrives in `protocol.rs`, to which
9295
- `mz_statement_lifecycle_history` would get the following events:
9396
- `StatementReceived`
94-
- `ParsingComplete`
95-
- `PrepareComplete`
97+
- `ParsingFinished`
98+
- `PrepareFinished`
9699
- `FrontendMessage::Bind` arrives in `protocol.rs`, to which
97100
- `mz_statement_lifecycle_history` would get the following events:
98101
- `BindReceived`
99-
- `BindComplete` (whose timestamp would probably be very close to `BindReceived`, but later we might do more interesting things at bind time, in which case binding will take more time)
102+
- `BindFinished` (whose timestamp would probably be very close to `BindReceived`, but later we might do more interesting things at bind time, in which case binding will take more time)
100103
- `FrontendMessage::Execute` arrives in `protocol.rs`, to which
101104
- `mz_statement_lifecycle_history` would get the following events:
102105
- `ExecuteReceived`

0 commit comments

Comments
 (0)