forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5ffb7c7
committed
De-pessimize ConditionVariableCancelSleep().
Commitb91dd9d was concerned with a theoretical problem with ournon-atomic condition variable operations. If you stop sleeping, andthen cancel the sleep in a separate step, you might be signaled inbetween, and that could be lost. That doesn't matter for callers ofConditionVariableBroadcast(), but callers of ConditionVariableSignal()might be upset if a signal went missing like this.Commitbc971f4 interacted badly with that logic, because it doesn'tuse ConditionVariableSleep(), which would normally put us back in thewait list. ConditionVariableCancelSleep() would be confused and thinkwe'd received an extra signal, and try to forward it to another backend,resulting in wakeup storms.New idea: ConditionVariableCancelSleep() can just return true if we'vebeen signaled. Hypothetical users of ConditionVariableSignal() wouldthen still have a way to deal with rare lost signals if they areconcerned about that problem.Back-patch to 16, wherebc971f4 arrived.Reported-by: Tomas Vondra <tomas.vondra@enterprisedb.com>Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/2840876b-4cfe-240f-0a7e-29ffd66711e7%40enterprisedb.com1 parent82a4eda commit5ffb7c7
File tree
2 files changed
+7
-11
lines changed- src
- backend/storage/lmgr
- include/storage
2 files changed
+7
-11
lines changedLines changed: 6 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
223 | 223 |
| |
224 | 224 |
| |
225 | 225 |
| |
| 226 | + | |
| 227 | + | |
226 | 228 |
| |
227 |
| - | |
| 229 | + | |
228 | 230 |
| |
229 | 231 |
| |
230 | 232 |
| |
231 | 233 |
| |
232 | 234 |
| |
233 | 235 |
| |
234 |
| - | |
| 236 | + | |
235 | 237 |
| |
236 | 238 |
| |
237 | 239 |
| |
| |||
240 | 242 |
| |
241 | 243 |
| |
242 | 244 |
| |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 |
| - | |
247 |
| - | |
248 |
| - | |
249 |
| - | |
250 |
| - | |
251 | 245 |
| |
| 246 | + | |
| 247 | + | |
252 | 248 |
| |
253 | 249 |
| |
254 | 250 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
59 |
| - | |
| 59 | + | |
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
|
0 commit comments
Comments
(0)