cockroachdb / cockroachdb/cockroach

sql: persist `planner` for a pausable portal

Open
#99,625 0 comments 0 reactions 0 assignees View on GitHub
A-pausable-portals C-bug T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

We now store the meta data needed for a portal's re-execution in `PreparedPortal.portalPauseInfo`. This field includes things such as `instrumentationHelper` and `planTop` which are to override the planner for each execution. But this can be error-prone and confusing as now we reset most of the fields of a planner, even though the underlying query is the same.

One more bullet-proof approach would be to embed planner object into the pause info struct, and then use that planner instance whenever we're operating with the pausable portals. `pauseInfo.planner` would be modified ("initialized") on the first execution of the portal, but then we will not call `resetPlanner()` on it. This way, with every re-execution we will let the resumed flow to modify our planner as the flow needs, and then we'll keep the state of the planner unchanged until the portal is resumed again. This approach will also let us remove fields like `portal.pauseInfo.ihWrapper`.

The key here is to determine what in planner should be retained and what should be updated for each execution.

Jira issue: CRDB-25987

Epic CRDB-25183

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.