forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitee3f8d3
committed
pgstat: Bring up pgstat in BaseInit() to fix uninitialized use of pgstat by AV.
Previously pgstat_initialize() was called in InitPostgres() andAuxiliaryProcessMain(). As it turns out there was at least one case where wereported stats before pgstat_initialize() was called, seeAutoVacWorkerMain()'s intentionally early call to pgstat_report_autovac().This turns out to not be a problem with the current pgstat implementation aspgstat_initialize() only registers a shutdown callback. But in the sharedmemory based stats implementation we are working towards pgstat_initialize()has to do more work.Afterb406478 BaseInit() is a central place where initialization shared bynormal backends and auxiliary backends can be put. Obviously BaseInit() iscalled before InitPostgres() registers ShutdownPostgres. PreviouslyShutdownPostgres was the first before_shmem_exit callback, now that's commonlypgstats. That should be fine.Previously pgstat_initialize() was not called in bootstrap mode, but theredoes not appear to be a need for that. It's now done unconditionally.To detect future issues like this, assertions are added to a few placesverifying that the pgstat subsystem is initialized and not yet shut down.Author: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/20210405092914.mmxqe7j56lsjfsej@alap3.anarazel.deDiscussion:https://postgr.es/m/20210802164124.ufo5buo4apl6yuvs@alap3.anarazel.de1 parent5c056b0 commitee3f8d3
File tree
3 files changed
+65
-13
lines changed- src/backend
- postmaster
- utils/init
3 files changed
+65
-13
lines changedLines changed: 0 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
128 |
| - | |
129 |
| - | |
130 | 128 |
| |
131 | 129 |
| |
132 | 130 |
| |
|
Lines changed: 51 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
295 | 295 |
| |
296 | 296 |
| |
297 | 297 |
| |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
298 | 307 |
| |
299 | 308 |
| |
300 | 309 |
| |
| |||
330 | 339 |
| |
331 | 340 |
| |
332 | 341 |
| |
| 342 | + | |
333 | 343 |
| |
334 | 344 |
| |
335 | 345 |
| |
| |||
854 | 864 |
| |
855 | 865 |
| |
856 | 866 |
| |
| 867 | + | |
| 868 | + | |
857 | 869 |
| |
858 | 870 |
| |
859 | 871 |
| |
| |||
1960 | 1972 |
| |
1961 | 1973 |
| |
1962 | 1974 |
| |
| 1975 | + | |
| 1976 | + | |
1963 | 1977 |
| |
1964 | 1978 |
| |
1965 | 1979 |
| |
| |||
2078 | 2092 |
| |
2079 | 2093 |
| |
2080 | 2094 |
| |
| 2095 | + | |
| 2096 | + | |
2081 | 2097 |
| |
2082 | 2098 |
| |
2083 | 2099 |
| |
| |||
2938 | 2954 |
| |
2939 | 2955 |
| |
2940 | 2956 |
| |
| 2957 | + | |
| 2958 | + | |
2941 | 2959 |
| |
2942 | 2960 |
| |
2943 | 2961 |
| |
| |||
2946 | 2964 |
| |
2947 | 2965 |
| |
2948 | 2966 |
| |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
2949 | 2971 |
| |
2950 | 2972 |
| |
2951 | 2973 |
| |
2952 | 2974 |
| |
2953 | 2975 |
| |
2954 |
| - | |
2955 |
| - | |
| 2976 | + | |
| 2977 | + | |
2956 | 2978 |
| |
2957 | 2979 |
| |
2958 | 2980 |
| |
2959 | 2981 |
| |
2960 | 2982 |
| |
2961 | 2983 |
| |
2962 | 2984 |
| |
| 2985 | + | |
| 2986 | + | |
2963 | 2987 |
| |
2964 | 2988 |
| |
2965 | 2989 |
| |
| |||
2969 | 2993 |
| |
2970 | 2994 |
| |
2971 | 2995 |
| |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
2972 | 3000 |
| |
2973 | 3001 |
| |
2974 | 3002 |
| |
| |||
3001 | 3029 |
| |
3002 | 3030 |
| |
3003 | 3031 |
| |
| 3032 | + | |
| 3033 | + | |
3004 | 3034 |
| |
3005 | 3035 |
| |
3006 | 3036 |
| |
| |||
3053 | 3083 |
| |
3054 | 3084 |
| |
3055 | 3085 |
| |
| 3086 | + | |
| 3087 | + | |
3056 | 3088 |
| |
3057 | 3089 |
| |
3058 | 3090 |
| |
| |||
4629 | 4661 |
| |
4630 | 4662 |
| |
4631 | 4663 |
| |
| 4664 | + | |
| 4665 | + | |
4632 | 4666 |
| |
4633 | 4667 |
| |
4634 | 4668 |
| |
| |||
4765 | 4799 |
| |
4766 | 4800 |
| |
4767 | 4801 |
| |
| 4802 | + | |
| 4803 | + | |
| 4804 | + | |
| 4805 | + | |
| 4806 | + | |
| 4807 | + | |
| 4808 | + | |
| 4809 | + | |
| 4810 | + | |
| 4811 | + | |
| 4812 | + | |
4768 | 4813 |
| |
4769 | 4814 |
| |
4770 | 4815 |
| |
| |||
4779 | 4824 |
| |
4780 | 4825 |
| |
4781 | 4826 |
| |
| 4827 | + | |
| 4828 | + | |
4782 | 4829 |
| |
4783 | 4830 |
| |
4784 | 4831 |
| |
| |||
5897 | 5944 |
| |
5898 | 5945 |
| |
5899 | 5946 |
| |
| 5947 | + | |
| 5948 | + | |
5900 | 5949 |
| |
5901 | 5950 |
| |
5902 | 5951 |
| |
|
Lines changed: 14 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
517 | 517 |
| |
518 | 518 |
| |
519 | 519 |
| |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
520 | 528 |
| |
521 | 529 |
| |
522 | 530 |
| |
| |||
646 | 654 |
| |
647 | 655 |
| |
648 | 656 |
| |
649 |
| - | |
650 |
| - | |
651 |
| - | |
652 |
| - | |
653 | 657 |
| |
654 | 658 |
| |
655 | 659 |
| |
| |||
662 | 666 |
| |
663 | 667 |
| |
664 | 668 |
| |
665 |
| - | |
666 |
| - | |
667 |
| - | |
668 |
| - | |
669 |
| - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
670 | 675 |
| |
671 | 676 |
| |
672 | 677 |
| |
|
0 commit comments
Comments
(0)