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
distsql: restore EvalCtx.Mon on the flow cleanup #69483
Conversation
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.
Thanks! This looks like a clean solution.
Reviewed 2 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)
In `setupFlow`, if we're setting up a flow on the gateway, we're using `LocalState` to save on deserialization of some state. Notably, we pass the eval context that we used during the physical planning. That eval context can be mutated (in particular, we're updating its `Mon` field to the "flow" memory monitor), and previously this could cause issues when automatically retrying stats collection jobs (possibly there could be other issues). This commit introduces a callback to restore the local eval context to its original state which is done on the flow cleanup. Release note (bug fix): Previously, table stats collection issued via `ANALYZE` statement or via `CREATE STATISTICS` statement without specifying `AS OF SYSTEM TIME` option could run into `flow: memory budget exceeded`, and this has been fixed. Release justification: fix to a long standing bug.
Release note: None Release justification: low-risk improvement to resources' cleanup in an edge case.
ca4bbd5
to
cf8acbf
Compare
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft)
TFTRs! bors r+ |
Build succeeded: |
distsql: restore EvalCtx.Mon on the flow cleanup
In
setupFlow
, if we're setting up a flow on the gateway, we're usingLocalState
to save on deserialization of some state. Notably, we passthe eval context that we used during the physical planning. That eval
context can be mutated (in particular, we're updating its
Mon
field tothe "flow" memory monitor), and previously this could cause issues when
automatically retrying stats collection jobs (possibly there could be
other issues).
This commit introduces a callback to restore the local eval context to
its original state which is done on the flow cleanup.
Fixes: #68670.
Fixes: #67113.
Release note (bug fix): Previously, table stats collection issued via
ANALYZE
statement or viaCREATE STATISTICS
statement withoutspecifying
AS OF SYSTEM TIME
option could run intoflow: memory budget exceeded
, and this has been fixed.Release justification: fix to a long standing bug.
distsql: fix cleaning up resources in an error case in setupFlow
Release note: None
Release justification: low-risk improvement to resources' cleanup in an
edge case.