Commit 623630f
committed
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: None1 parent 7536bef commit 623630f
File tree
3 files changed
+17
-2
lines changed- pkg/sql
3 files changed
+17
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2455 | 2455 | | |
2456 | 2456 | | |
2457 | 2457 | | |
2458 | | - | |
| 2458 | + | |
2459 | 2459 | | |
2460 | 2460 | | |
2461 | 2461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2765 | 2765 | | |
2766 | 2766 | | |
2767 | 2767 | | |
2768 | | - | |
| 2768 | + | |
| 2769 | + | |
2769 | 2770 | | |
2770 | 2771 | | |
2771 | 2772 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
141 | 145 | | |
142 | 146 | | |
143 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
144 | 158 | | |
145 | 159 | | |
146 | 160 | | |
| |||
0 commit comments