forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdd9c6ff
committed
Fix longstanding race condition in plancache.c.
When creating or manipulating a cached plan for a transaction controlcommand (particularly ROLLBACK), we must not perform any catalog accesses,since we might be in an aborted transaction. However, plancache.c busilysaved or examined the search_path for every cached plan. If we wereunlucky enough to do this at a moment where the path's expansion intoschema OIDs wasn't already cached, we'd do some catalog accesses; and withsome more bad luck such as an ill-timed signal arrival, that could lead tocrashes or Assert failures, as exhibited in bug #8095 from Nachiket Vaidya.Fortunately, there's no real need to consider the search path for suchcommands, so we can just skip the relevant steps when the subject statementis a TransactionStmt. This is somewhat related to bug #5269, though thefailure happens during initial cached-plan creation rather thanrevalidation.This bug has been there since the plan cache was invented, so back-patchto all supported branches.1 parent8e00c48 commitdd9c6ff
1 file changed
+24
-6
lines changedLines changed: 24 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
64 | 72 |
| |
65 | 73 |
| |
66 | 74 |
| |
| |||
136 | 144 |
| |
137 | 145 |
| |
138 | 146 |
| |
139 |
| - | |
| 147 | + | |
| 148 | + | |
140 | 149 |
| |
141 |
| - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
142 | 154 |
| |
143 | 155 |
| |
144 | 156 |
| |
| |||
229 | 241 |
| |
230 | 242 |
| |
231 | 243 |
| |
232 |
| - | |
| 244 | + | |
| 245 | + | |
233 | 246 |
| |
234 |
| - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
235 | 251 |
| |
236 | 252 |
| |
237 | 253 |
| |
| |||
517 | 533 |
| |
518 | 534 |
| |
519 | 535 |
| |
520 |
| - | |
| 536 | + | |
| 537 | + | |
521 | 538 |
| |
522 | 539 |
| |
523 | 540 |
| |
| |||
601 | 618 |
| |
602 | 619 |
| |
603 | 620 |
| |
604 |
| - | |
| 621 | + | |
| 622 | + | |
605 | 623 |
| |
606 | 624 |
| |
607 | 625 |
| |
|
0 commit comments
Comments
(0)