forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit887feef
committed
Don't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch.
This coding pattern creates a race condition, because if an interestinginterrupt happens after we've checked InterruptPending but before we resetour latch, the latch-setting done by the signal handler would get lost,and then we might block at WaitLatch in the next iteration without evernoticing the interrupt condition. You can put the CHECK_FOR_INTERRUPTSbefore WaitLatch or after ResetLatch, but not between them.Aside from fixing the bugs, add some explanatory comments to latch.hto perhaps forestall the next person from making the same mistake.In HEAD, also replace gather_readnext's direct call ofHandleParallelMessages with CHECK_FOR_INTERRUPTS. It does not seem cleanor useful for this one caller to bypass ProcessInterrupts and go straightto HandleParallelMessages; not least because that fails to consider theInterruptPending flag, resulting in useless work both here(if InterruptPending isn't set) and in the next CHECK_FOR_INTERRUPTS call(if it is).This thinko seems to have been introduced in the initial coding ofstorage/ipc/shm_mq.c (commitec9037d), and then blindly copied into allthe subsequent parallel-query support logic. Back-patch relevant hunksto 9.4 to extirpate the error everywhere.Discussion: <1661.1469996911@sss.pgh.pa.us>1 parentdd5eb80 commit887feef
6 files changed
+32
-17
lines changedLines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
330 | 330 |
| |
331 | 331 |
| |
332 | 332 |
| |
333 |
| - | |
334 |
| - | |
| 333 | + | |
| 334 | + | |
335 | 335 |
| |
336 | 336 |
| |
337 | 337 |
| |
| |||
388 | 388 |
| |
389 | 389 |
| |
390 | 390 |
| |
391 |
| - | |
392 | 391 |
| |
393 | 392 |
| |
394 | 393 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
172 | 172 |
| |
173 | 173 |
| |
174 | 174 |
| |
175 |
| - | |
176 | 175 |
| |
| 176 | + | |
177 | 177 |
| |
178 | 178 |
| |
179 | 179 |
| |
|
Lines changed: 9 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
896 | 896 |
| |
897 | 897 |
| |
898 | 898 |
| |
899 |
| - | |
900 |
| - | |
901 |
| - | |
902 | 899 |
| |
903 | 900 |
| |
| 901 | + | |
| 902 | + | |
| 903 | + | |
904 | 904 |
| |
905 | 905 |
| |
906 | 906 |
| |
| |||
993 | 993 |
| |
994 | 994 |
| |
995 | 995 |
| |
996 |
| - | |
997 |
| - | |
998 |
| - | |
999 | 996 |
| |
1000 | 997 |
| |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
1001 | 1001 |
| |
1002 | 1002 |
| |
1003 | 1003 |
| |
| |||
1092 | 1092 |
| |
1093 | 1093 |
| |
1094 | 1094 |
| |
1095 |
| - | |
1096 |
| - | |
1097 |
| - | |
1098 | 1095 |
| |
1099 | 1096 |
| |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1100 | 1100 |
| |
1101 | 1101 |
| |
1102 | 1102 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
55 | 71 |
| |
56 | 72 |
| |
57 | 73 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
281 | 281 |
| |
282 | 282 |
| |
283 | 283 |
| |
284 |
| - | |
285 |
| - | |
286 |
| - | |
287 | 284 |
| |
288 | 285 |
| |
| 286 | + | |
| 287 | + | |
| 288 | + | |
289 | 289 |
| |
290 | 290 |
| |
291 | 291 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
231 | 231 |
| |
232 | 232 |
| |
233 | 233 |
| |
234 |
| - | |
235 | 234 |
| |
| 235 | + | |
236 | 236 |
| |
237 | 237 |
| |
238 | 238 |
| |
|
0 commit comments
Comments
(0)