- Notifications
You must be signed in to change notification settings - Fork28
Commitad1b5c8
committed
Ignore old stats file timestamps when starting the stats collector.
The stats collector disregards inquiry messages that bear a cutoff_timebefore when it last wrote the relevant stats file. That's fine, but atstartup when it reads the "permanent" stats files, it absorbed theirtimestamps as if they were the times at which the corresponding temporarystats files had been written. In reality, of course, there's no dataout there at all. This led to disregarding inquiry messages soon afterstartup if the postmaster had been shut down and restarted within lessthan PGSTAT_STAT_INTERVAL; which is a pretty common scenario, both fortesting and in the field. Requesting backends would hang for 10 secondsand then report failure to read statistics, unless they got bailed outby some other backend coming along and making a newer request withinthat interval.I came across this through investigating unexpected delays in thesrc/test/recovery TAP tests: it manifests there because the autovacuumlauncher hangs for 10 seconds when it can't get statistics at startup,thus preventing a second shutdown from occurring promptly. We mightwant to do some things in the autovac code to make it less prone togetting stuck that way, but this change is a good bug fix regardless.In passing, also fix pgstat_read_statsfiles() to ensure that itre-zeroes its global stats variables if they are corrupted by ashort read from the stats file. (Other reads in that functiongo into temp variables, so that the issue doesn't arise.)This has been broken since we created the separation between permanentand temporary stats files in 8.4, so back-patch to all supported branches.Discussion:https://postgr.es/m/16860.1498442626@sss.pgh.pa.us1 parentc61559e commitad1b5c8
1 file changed
+21
-0
lines changedLines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4947 | 4947 |
| |
4948 | 4948 |
| |
4949 | 4949 |
| |
| 4950 | + | |
4950 | 4951 |
| |
4951 | 4952 |
| |
4952 | 4953 |
| |
| 4954 | + | |
| 4955 | + | |
| 4956 | + | |
| 4957 | + | |
| 4958 | + | |
| 4959 | + | |
| 4960 | + | |
| 4961 | + | |
| 4962 | + | |
| 4963 | + | |
4953 | 4964 |
| |
4954 | 4965 |
| |
4955 | 4966 |
| |
4956 | 4967 |
| |
4957 | 4968 |
| |
4958 | 4969 |
| |
4959 | 4970 |
| |
| 4971 | + | |
4960 | 4972 |
| |
4961 | 4973 |
| |
4962 | 4974 |
| |
| |||
5001 | 5013 |
| |
5002 | 5014 |
| |
5003 | 5015 |
| |
| 5016 | + | |
| 5017 | + | |
| 5018 | + | |
| 5019 | + | |
| 5020 | + | |
| 5021 | + | |
| 5022 | + | |
| 5023 | + | |
| 5024 | + | |
5004 | 5025 |
| |
5005 | 5026 |
| |
5006 | 5027 |
| |
|
0 commit comments
Comments
(0)