forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8b7ae5a
committed
Stabilize the results of pg_notification_queue_usage().
This function wasn't touched in commit51004c7, but that turns outto be a bad idea, because its results now include any dead spacethat exists in the NOTIFY queue on account of our being lazy aboutadvancing the queue tail. Notably, the isolation tests now failif run twice without a server restart between, because async-notify'sfirst test of the function will already show a positive value.It seems likely that end users would be equally unhappy about theresult's instability. To fix, just make the function callasyncQueueAdvanceTail before computing its result. That should endin producing the same value as before, and it's hard to believe thatthere's any practical use-case where pg_notification_queue_usage()is called so often as to create a performance degradation, especiallycompared to what we did before.Out of paranoia, also mark this function parallel-restricted (itwas volatile, but parallel-safe by default, before). Although thecode seems to work fine when run in a parallel worker, that's outsidethe design scope of async.c, and it's a bit scary to have intentionalside-effects happening in a parallel worker. There seems no plausibleuse-case where it'd be important to try to parallelize this, so let'snot take any risk of introducing new bugs.In passing, re-pgindent async.c and run reformat-dat-files onpg_proc.dat, just because I'm a neatnik.Discussion:https://postgr.es/m/13881.1574557302@sss.pgh.pa.us1 parent91da65f commit8b7ae5a
File tree
3 files changed
+19
-19
lines changed- src
- backend/commands
- include/catalog
3 files changed
+19
-19
lines changedLines changed: 10 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
347 | 347 |
| |
348 | 348 |
| |
349 | 349 |
| |
350 |
| - | |
| 350 | + | |
351 | 351 |
| |
352 | 352 |
| |
353 | 353 |
| |
| |||
393 | 393 |
| |
394 | 394 |
| |
395 | 395 |
| |
396 |
| - | |
| 396 | + | |
397 | 397 |
| |
398 | 398 |
| |
399 | 399 |
| |
| |||
1554 | 1554 |
| |
1555 | 1555 |
| |
1556 | 1556 |
| |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1557 | 1560 |
| |
1558 | 1561 |
| |
1559 | 1562 |
| |
| |||
1834 | 1837 |
| |
1835 | 1838 |
| |
1836 | 1839 |
| |
1837 |
| - | |
1838 |
| - | |
1839 |
| - | |
| 1840 | + | |
| 1841 | + | |
1840 | 1842 |
| |
1841 | 1843 |
| |
1842 | 1844 |
| |
| |||
2400 | 2402 |
| |
2401 | 2403 |
| |
2402 | 2404 |
| |
2403 |
| - | |
2404 |
| - | |
2405 |
| - | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
2406 | 2408 |
| |
2407 | 2409 |
| |
2408 | 2410 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
|
Lines changed: 8 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7653 | 7653 |
| |
7654 | 7654 |
| |
7655 | 7655 |
| |
7656 |
| - | |
| 7656 | + | |
7657 | 7657 |
| |
7658 | 7658 |
| |
7659 | 7659 |
| |
| |||
9333 | 9333 |
| |
9334 | 9334 |
| |
9335 | 9335 |
| |
9336 |
| - | |
9337 |
| - | |
| 9336 | + | |
| 9337 | + | |
9338 | 9338 |
| |
9339 | 9339 |
| |
9340 |
| - | |
9341 |
| - | |
9342 |
| - | |
9343 |
| - | |
| 9340 | + | |
| 9341 | + | |
| 9342 | + | |
9344 | 9343 |
| |
9345 | 9344 |
| |
9346 | 9345 |
| |
| |||
9350 | 9349 |
| |
9351 | 9350 |
| |
9352 | 9351 |
| |
9353 |
| - | |
9354 |
| - | |
9355 |
| - | |
| 9352 | + | |
| 9353 | + | |
9356 | 9354 |
| |
9357 | 9355 |
| |
9358 | 9356 |
| |
|
0 commit comments
Comments
(0)