cockroachdb / cockroachdb/cockroach
sql: fix phase time and session tracing for pausable portals
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Originally, a query's lifecycle is expected to be complete in the closure of `connExecutor.dispatchToExecutionEngine()`. This is no longer true for pausable portals as we will rerun this function when re-executing the same portal. For example, the phase `sessionphase.PlannerStartExecStmt` maybe should only happen when the query is run for the first time.
https://github.com/cockroachdb/cockroach/blob/d8ea15c875bcdce02cc6325037460b2a3ef7054a/pkg/sql/conn_executor_exec.go#L1305
Similarly, maybe we should set the `sessionTracing.TracePlanEnd` only when we close the portal.
https://github.com/cockroachdb/cockroach/blob/2bd2c806ab3044569b09e0a205b5bc0452ad4e2b/pkg/sql/conn_executor_exec.go#L1277
Or maybe we have these phases to be execution-bound rather than query-bound, but we should make it more explicit for pausable portals. Alternatively, we may want to have both execution-bound and query-bound phase markers.
Jira issue: CRDB-25870
Epic CRDB-25183
Contributor guide
Assessment
This issue has not been assessed yet.