forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit675c945
committed
Move temporary file cleanup to before_shmem_exit().
As reported by a few OSX buildfarm animals there exist at least one path wheretemporary files exist during AtProcExit_Files() processing. As temporary filecleanup causes pgstat reporting, the assertions added inee3f8d3 causedfailures.This is not an OSX specific issue, we were just lucky that timing on OSXreliably triggered the problem. The known way to cause this is a FATAL errorduring perform_base_backup() with a MANIFEST used - adding an elog(FATAL)after InitializeBackupManifest() reliably reproduces the problem in isolation.The problem is that the temporary file created in InitializeBackupManifest()is not cleaned up via resource owner cleanup as WalSndResourceCleanup()currently is only used for non-FATAL errors. That then allows to reachAtProcExit_Files() with existing temporary files, causing the assertionfailure.To fix this problem, move temporary file cleanup to a before_shmem_exit() hookand add assertions ensuring that no temporary files are created before / aftertemporary file management has been initialized / shut down. The cleanest wayto do so seems to be to split fd.c initialization into two, one for plain fileaccess and one for temporary file access.Right now there's no need to perform further fd.c cleanup during process exit,so I just renamed AtProcExit_Files() to BeforeShmemExit_Files(). Alternativelywe could perform another pass through the files to check that no temporaryfiles exist, but the added assertions seem to provide enough protectionagainst that.It might turn out that the assertions added inee3f8d3 will cause too muchnoise - in that case we'll have to downgrade them to a WARNING, at leasttemporarily.This commit is not necessarily the best approach to address this issue, but itshould resolve the buildfarm failures. We can revise later.Author: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/20210807190131.2bm24acbebl4wl6i@alap3.anarazel.de1 parent256909c commit675c945
File tree
3 files changed
+65
-8
lines changed- src
- backend
- storage/file
- utils/init
- include/storage
3 files changed
+65
-8
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
231 | 231 |
| |
232 | 232 |
| |
233 | 233 |
| |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
234 | 239 |
| |
235 | 240 |
| |
236 | 241 |
| |
| |||
327 | 332 |
| |
328 | 333 |
| |
329 | 334 |
| |
330 |
| - | |
| 335 | + | |
331 | 336 |
| |
332 | 337 |
| |
333 | 338 |
| |
| |||
868 | 873 |
| |
869 | 874 |
| |
870 | 875 |
| |
| 876 | + | |
| 877 | + | |
| 878 | + | |
871 | 879 |
| |
872 | 880 |
| |
873 | 881 |
| |
| |||
885 | 893 |
| |
886 | 894 |
| |
887 | 895 |
| |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
888 | 921 |
| |
889 |
| - | |
890 |
| - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
891 | 925 |
| |
892 | 926 |
| |
893 | 927 |
| |
| |||
1670 | 1704 |
| |
1671 | 1705 |
| |
1672 | 1706 |
| |
| 1707 | + | |
| 1708 | + | |
1673 | 1709 |
| |
1674 | 1710 |
| |
1675 | 1711 |
| |
| |||
1805 | 1841 |
| |
1806 | 1842 |
| |
1807 | 1843 |
| |
| 1844 | + | |
| 1845 | + | |
1808 | 1846 |
| |
1809 | 1847 |
| |
1810 | 1848 |
| |
| |||
1843 | 1881 |
| |
1844 | 1882 |
| |
1845 | 1883 |
| |
| 1884 | + | |
| 1885 | + | |
1846 | 1886 |
| |
1847 | 1887 |
| |
1848 | 1888 |
| |
| |||
3004 | 3044 |
| |
3005 | 3045 |
| |
3006 | 3046 |
| |
3007 |
| - | |
| 3047 | + | |
3008 | 3048 |
| |
3009 |
| - | |
| 3049 | + | |
3010 | 3050 |
| |
3011 | 3051 |
| |
3012 | 3052 |
| |
3013 |
| - | |
| 3053 | + | |
3014 | 3054 |
| |
3015 | 3055 |
| |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
3016 | 3061 |
| |
3017 | 3062 |
| |
3018 | 3063 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
517 | 517 |
| |
518 | 518 |
| |
519 | 519 |
| |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
520 | 526 |
| |
521 | 527 |
| |
522 | 528 |
| |
| |||
525 | 531 |
| |
526 | 532 |
| |
527 | 533 |
| |
528 |
| - | |
529 |
| - | |
| 534 | + | |
530 | 535 |
| |
531 | 536 |
| |
532 | 537 |
| |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
533 | 544 |
| |
534 | 545 |
| |
535 | 546 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
158 | 158 |
| |
159 | 159 |
| |
160 | 160 |
| |
| 161 | + | |
161 | 162 |
| |
162 | 163 |
| |
163 | 164 |
| |
|
0 commit comments
Comments
(0)