- Notifications
You must be signed in to change notification settings - Fork28
Commit4d5840c
committed
Fix problems with auto-held portals.
HoldPinnedPortals() did things in the wrong order: it must not marka portal autoHeld until it's been successfully held. Otherwise,a failure while persisting the portal results in a server crashbecause we think the portal is in a good state when it's not.Also add a check that portal->status is READY before attempting tohold a pinned portal. We have such a check before the only otheruse of HoldPortal(), so it seems unwise not to check it here.Lastly, rethink the responsibility for where to call HoldPinnedPortals.The comment for it imagined that it was optional for any individual PLto call it or not, but that cannot be the case: if some outer level ofprocedure has a pinned portal, failing to persist it when an innerprocedure commits is going to be trouble. Let's have SPI do it insteadof the individual PLs. That's not a complete solution, since in theorya PL might not be using SPI to perform commit/rollback, but such a PLis going to have to be aware of lots of related requirements anyway.(This change doesn't cause an API break for any external PLs that mightbe calling HoldPinnedPortals per the old regime, because calling ittwice during a commit or rollback sequence won't hurt.)Per bug #15703 from Julian Schauder. Back-patch to v11 where this codecame in.Discussion:https://postgr.es/m/15703-c12c5bc0ea34ba26@postgresql.org1 parent148266f commit4d5840c
File tree
7 files changed
+117
-20
lines changed- src
- backend
- executor
- utils/mmgr
- pl
- plperl
- plpgsql/src
- expected
- sql
- plpython
7 files changed
+117
-20
lines changedLines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
241 | 241 |
| |
242 | 242 |
| |
243 | 243 |
| |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
244 | 252 |
| |
245 | 253 |
| |
246 | 254 |
| |
| |||
294 | 302 |
| |
295 | 303 |
| |
296 | 304 |
| |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
297 | 314 |
| |
298 | 315 |
| |
299 | 316 |
| |
|
Lines changed: 18 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1226 | 1226 |
| |
1227 | 1227 |
| |
1228 | 1228 |
| |
1229 |
| - | |
1230 |
| - | |
1231 |
| - | |
1232 |
| - | |
1233 |
| - | |
1234 |
| - | |
1235 |
| - | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
1236 | 1242 |
| |
1237 | 1243 |
| |
1238 | 1244 |
| |
| |||
1262 | 1268 |
| |
1263 | 1269 |
| |
1264 | 1270 |
| |
1265 |
| - | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
1266 | 1275 |
| |
| 1276 | + | |
1267 | 1277 |
| |
1268 | 1278 |
| |
1269 | 1279 |
|
Lines changed: 0 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3988 | 3988 |
| |
3989 | 3989 |
| |
3990 | 3990 |
| |
3991 |
| - | |
3992 |
| - | |
3993 | 3991 |
| |
3994 | 3992 |
| |
3995 | 3993 |
| |
| |||
4015 | 4013 |
| |
4016 | 4014 |
| |
4017 | 4015 |
| |
4018 |
| - | |
4019 |
| - | |
4020 | 4016 |
| |
4021 | 4017 |
| |
4022 | 4018 |
| |
|
Lines changed: 44 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
401 | 401 |
| |
402 | 402 |
| |
403 | 403 |
| |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
404 | 448 |
| |
405 | 449 |
| |
406 | 450 |
| |
|
Lines changed: 0 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4791 | 4791 |
| |
4792 | 4792 |
| |
4793 | 4793 |
| |
4794 |
| - | |
4795 |
| - | |
4796 | 4794 |
| |
4797 | 4795 |
| |
4798 | 4796 |
| |
| |||
4815 | 4813 |
| |
4816 | 4814 |
| |
4817 | 4815 |
| |
4818 |
| - | |
4819 |
| - | |
4820 | 4816 |
| |
4821 | 4817 |
| |
4822 | 4818 |
| |
|
Lines changed: 38 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
329 | 329 |
| |
330 | 330 |
| |
331 | 331 |
| |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
332 | 370 |
| |
333 | 371 |
| |
334 | 372 |
| |
|
Lines changed: 0 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
588 | 588 |
| |
589 | 589 |
| |
590 | 590 |
| |
591 |
| - | |
592 |
| - | |
593 | 591 |
| |
594 | 592 |
| |
595 | 593 |
| |
| |||
604 | 602 |
| |
605 | 603 |
| |
606 | 604 |
| |
607 |
| - | |
608 |
| - | |
609 | 605 |
| |
610 | 606 |
| |
611 | 607 |
| |
|
0 commit comments
Comments
(0)