You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sql: fix minor bug around disabling portal pausability
I've been reviewing the pausable portal code, and I think I found
a minor bug that doesn't actually appear to have any consequences. What
happens is that if we created a pausable portal, but then it's executed
without a limit (i.e. `MaxRows` is not set on `Execute`), then we
disable pausability since the portal will run to completion. We do that
by modifying a _copy_ of `PreparedPortal` struct that is used throughout
the execution, yet we don't update the map that stores all portals. Note
that other nested things (like `portalPauseInfo`) are stored by
reference, so modifications to them are reflected in the copy stored in
the map, so I think things just happen to work out. Still, it seems
prudent to update the copy that we store in the map with the fact that
pausability was disabled.
A similar issue is present when we revoke the portal pausability - we
modify the copy of PreparedPortal and don't update the map. Additionally,
here we explicitly reset `planner.pausablePortal` to `nil` when revoking
pausability. I audited all cleanup functions, and they should behave
correctly: namely, we'll have nil'ed out `pauseInfo`, so the portal won't
be considered pausable, and the cleanup will be performed right away,
avoiding the pausauble portal cleanup stacks.
Release note: None
0 commit comments