forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite81e8f9
committed
Split up process latch initialization for more-fail-soft behavior.
In the previous coding, new backend processes would attempt to create theirself-pipe during the OwnLatch call in InitProcess. However, pipe creationcould fail if the kernel is short of resources; and the system does notrecover gracefully from a FATAL error right there, since we have armed thedead-man switch for this process and not yet set up the on_shmem_exitcallback that would disarm it. The postmaster then forces an unnecessarydatabase-wide crash and restart, as reported by Sean Chittenden.There are various ways we could rearrange the code to fix this, but thesimplest and sanest seems to be to split out creation of the self-pipe intoa new function InitializeLatchSupport, which must be called from a placewhere failure is allowed. For most processes that gets called inInitProcess or InitAuxiliaryProcess, but processes that don't call eitherbut still use latches need their own calls.Back-patch to 9.1, which has only a part of the latch logic that 9.2 andHEAD have, but nonetheless includes this bug.1 parent8b728e5 commite81e8f9
File tree
7 files changed
+67
-36
lines changed- src
- backend
- port
- postmaster
- storage/lmgr
- include/storage
7 files changed
+67
-36
lines changedLines changed: 38 additions & 34 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
63 |
| - | |
64 |
| - | |
65 |
| - | |
| 63 | + | |
66 | 64 |
| |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
67 | 94 |
| |
| 95 | + | |
| 96 | + | |
| 97 | + | |
68 | 98 |
| |
69 | 99 |
| |
70 | 100 |
| |
71 | 101 |
| |
72 | 102 |
| |
73 | 103 |
| |
74 | 104 |
| |
75 |
| - | |
76 |
| - | |
77 |
| - | |
| 105 | + | |
| 106 | + | |
78 | 107 |
| |
79 | 108 |
| |
80 | 109 |
| |
| |||
116 | 145 |
| |
117 | 146 |
| |
118 | 147 |
| |
119 |
| - | |
| 148 | + | |
| 149 | + | |
120 | 150 |
| |
121 |
| - | |
122 |
| - | |
123 |
| - | |
| 151 | + | |
124 | 152 |
| |
125 | 153 |
| |
126 | 154 |
| |
| |||
514 | 542 |
| |
515 | 543 |
| |
516 | 544 |
| |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
523 |
| - | |
524 |
| - | |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 |
| - | |
529 |
| - | |
530 |
| - | |
531 |
| - | |
532 |
| - | |
533 |
| - | |
534 |
| - | |
535 |
| - | |
536 |
| - | |
537 |
| - | |
538 |
| - | |
539 |
| - | |
540 |
| - | |
541 | 545 |
| |
542 | 546 |
| |
543 | 547 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
33 | 39 |
| |
34 | 40 |
| |
35 | 41 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
234 | 234 |
| |
235 | 235 |
| |
236 | 236 |
| |
237 |
| - | |
238 |
| - | |
239 | 237 |
| |
240 | 238 |
| |
241 | 239 |
| |
| |||
247 | 245 |
| |
248 | 246 |
| |
249 | 247 |
| |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
250 | 252 |
| |
251 | 253 |
| |
252 | 254 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3022 | 3022 |
| |
3023 | 3023 |
| |
3024 | 3024 |
| |
| 3025 | + | |
| 3026 | + | |
3025 | 3027 |
| |
3026 | 3028 |
| |
3027 | 3029 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
251 | 251 |
| |
252 | 252 |
| |
253 | 253 |
| |
| 254 | + | |
| 255 | + | |
254 | 256 |
| |
255 | 257 |
| |
256 | 258 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
279 | 279 |
| |
280 | 280 |
| |
281 | 281 |
| |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
282 | 289 |
| |
283 | 290 |
| |
284 | 291 |
| |
| |||
451 | 458 |
| |
452 | 459 |
| |
453 | 460 |
| |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
454 | 468 |
| |
455 | 469 |
| |
456 | 470 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
111 | 111 |
| |
112 | 112 |
| |
113 | 113 |
| |
| 114 | + | |
114 | 115 |
| |
115 | 116 |
| |
116 | 117 |
| |
|
0 commit comments
Comments
(0)