forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2cd4e83
committed
Fix contrib/auto_explain to not cause problems in parallel workers.
A parallel worker process should not be making any decisions of itsown about whether to auto-explain. If the parent session processpassed down flags asking for instrumentation data, do that, otherwisenot. Trying to enable instrumentation anyway leads to bugs like the"could not find key N in shm TOC" failure reported in bug #15821from Christian Hofstaedtler.We can implement this cheaply by piggybacking on the existing logicfor not doing anything when we've chosen not to sample a statement.While at it, clean up some tin-eared coding related to the samplingfeature, including an off-by-one error that meant that asking for 1.0sampling rate didn't actually result in sampling every statement.Although the specific case reported here only manifested in >= v11,I believe that related misbehaviors can be demonstrated in any versionthat has parallel query; and the off-by-one error is certainly thereback to 9.6 where that feature was added. So back-patch to 9.6.Discussion:https://postgr.es/m/15821-5eb422e980594075@postgresql.org1 parenteaf0292 commit2cd4e83
1 file changed
+28
-15
lines changedLines changed: 28 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
17 | 18 |
| |
18 | 19 |
| |
19 | 20 |
| |
| |||
59 | 60 |
| |
60 | 61 |
| |
61 | 62 |
| |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
62 | 71 |
| |
63 | 72 |
| |
64 | 73 |
| |
65 | 74 |
| |
66 | 75 |
| |
67 | 76 |
| |
68 |
| - | |
69 |
| - | |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
74 |
| - | |
75 | 77 |
| |
76 | 78 |
| |
77 | 79 |
| |
| |||
249 | 251 |
| |
250 | 252 |
| |
251 | 253 |
| |
252 |
| - | |
253 |
| - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
254 | 262 |
| |
255 |
| - | |
256 |
| - | |
257 |
| - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
258 | 271 |
| |
259 |
| - | |
| 272 | + | |
260 | 273 |
| |
261 | 274 |
| |
262 | 275 |
| |
| |||
275 | 288 |
| |
276 | 289 |
| |
277 | 290 |
| |
278 |
| - | |
| 291 | + | |
279 | 292 |
| |
280 | 293 |
| |
281 | 294 |
| |
| |||
346 | 359 |
| |
347 | 360 |
| |
348 | 361 |
| |
349 |
| - | |
| 362 | + | |
350 | 363 |
| |
351 | 364 |
| |
352 | 365 |
| |
|
0 commit comments
Comments
(0)