Move statement lifecycle begin up to Adapter frontend #32650
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the first part of #32504, namely the moving of
began_at(and the correspondingexecution-beganevent in the lifecycle table) up to the Adapter frontend (protocol.rs) from the Coordinator. For this, we pass down the timestamp from the Adapter frontend to the Coordinator through the Portal. Specifically, we take the timestamp after theself.conn.recv()returns, and pass it down for Simple Queries as well as for theFrontendMessage::Executeof the Extended Query flow.The
LifecycleTimestampsstruct contains only one field for now, but I plan to add more things to it later.Testing is a bit hard for this, but I did the following:
statement-logging.tdto test thatmz_statement_execution_history.began_atis always exactly the same asmz_statement_lifecycle_history.occurred_aton theexecution-beganevent. On main, these were close, but not always exactly the same, as the two timestamps were taken in separate calls toself.now(). (I've verified that the test indeed doesn't always pass on main.)began_atis taken in the Adapter frontend is a bit harder. I couldn't think of a regression test for this (I'm open to ideas), but I did some tests with extra code that is not possible to merge:panic!in theelsebranch of thelet began_at = if let Some(lifecycle_timestamps) = lifecycle_timestamps, the panic doesn't happen while runningstatement-logging.tdor when running slts or when running queries manually.Some(FrontendMessage::Execute {match arm inprotocol.rs, and verified thatfinished_at - began_atincludes that sleep on the PR, but not onmain. (Note that Testdrive submits queries using the Extended Query flow.)Motivation
Tips for reviewer
Checklist
$T ⇔ Proto$Tmapping (possibly in a backwards-incompatible way), then it is tagged with aT-protolabel.