forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6fea655
committed
Tighten ComputeXidHorizons' handling of walsenders.
ComputeXidHorizons (nee GetOldestXmin) thought that it could identifywalsenders by checking for proc->databaseId == 0. Perhaps that wassafe when the code was written, but it's been wrong at least sinceautovacuum was invented. Background processes that aren't connectedto any particular database, such as the autovacuum launcher andlogical replication launcher, look like that too.This imprecision is harmful because when such a process advertises anxmin, the result is to hold back dead-tuple cleanup in all databases,though it'd be sufficient to hold it back in shared catalogs (whichare the only relations such a process can access). Aside from beinggenerally inefficient, this has recently been seen to cause regressiontest failures in the buildfarm, as a consequence of the logicalreplication launcher's startup transaction preventing VACUUM frommarking pages of a user table as all-visible.We only want that global hold-back effect for the case where awalsender is advertising a hot standby feedback xmin. Therefore,invent a new PGPROC flag that says that a process' xmin should beconsidered globally, and check that instead of using the incorrectdatabaseId == 0 test. Currently only a walsender sets that flag,and only if it is not connected to any particular database. (This isfor bug-compatibility with the undocumented behavior of the existingcode, namely that feedback sent by a client who has connected to aparticular database would not be applied globally. I'm not sure thisis a great definition; however, such a client is capable of issuingplain SQL commands, and I don't think we want xmins advertised forsuch commands to be applied globally. Perhaps this could do withrefinement later.)While at it, I rewrote the comment in ComputeXidHorizons, andre-ordered the commented-upon if-tests, to make them match upfor intelligibility's sake.This is arguably a back-patchable bug fix, but given the lack ofcomplaints I think it prudent to let it age awhile in HEAD first.Discussion:https://postgr.es/m/1346227.1649887693@sss.pgh.pa.us1 parentbdb71db commit6fea655
File tree
3 files changed
+46
-17
lines changed- src
- backend
- replication
- storage/ipc
- include/storage
3 files changed
+46
-17
lines changedLines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
285 | 285 |
| |
286 | 286 |
| |
287 | 287 |
| |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
288 | 303 |
| |
289 | 304 |
| |
290 | 305 |
| |
|
Lines changed: 28 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1810 | 1810 |
| |
1811 | 1811 |
| |
1812 | 1812 |
| |
1813 |
| - | |
1814 |
| - | |
1815 |
| - | |
1816 |
| - | |
| 1813 | + | |
| 1814 | + | |
1817 | 1815 |
| |
1818 |
| - | |
1819 |
| - | |
1820 |
| - | |
1821 |
| - | |
1822 |
| - | |
1823 |
| - | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
1824 | 1830 |
| |
1825 |
| - | |
1826 |
| - | |
1827 |
| - | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
1828 | 1835 |
| |
1829 | 1836 |
| |
1830 | 1837 |
| |
| |||
2681 | 2688 |
| |
2682 | 2689 |
| |
2683 | 2690 |
| |
2684 |
| - | |
2685 |
| - | |
2686 |
| - | |
2687 |
| - | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
2688 | 2699 |
| |
2689 | 2700 |
| |
2690 | 2701 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
| 63 | + | |
| 64 | + | |
| 65 | + | |
63 | 66 |
| |
64 | 67 |
| |
65 | 68 |
| |
|
0 commit comments
Comments
(0)