forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita54e1f1
committed
Fix bugs in vacuum of shared rels, by keeping their relcache entries current.
When vacuum processes a relation it uses the corresponding relcacheentry's relfrozenxid / relminmxid as a cutoff for when to removetuples etc. Unfortunately for nailed relations (i.e. critical systemcatalogs) bugs could frequently lead to the corresponding relcacheentry being stale.This set of bugs could cause actual data corruption as vacuum wouldpotentially not remove the correct row versions, potentially revivingthem at a later point. After699bf7d some corruptions in this veinwere prevented, but the additional error checks could also triggerspuriously. Examples of such errors are: ERROR: found xmin ... from before relfrozenxid ...and ERROR: found multixact ... from before relminmxid ...To be caused by this bug the errors have to occur on system catalogtables.The two bugs are:1) Invalidations for nailed relations were ignored, based on the theory that the relcache entry for such tables doesn't change. Which is largely true, except for fields like relfrozenxid etc. This means that changes to relations vacuumed in other sessions weren't picked up by already existing sessions. Luckily autovacuum doesn't have particularly longrunning sessions.2) For shared *and* nailed relations, the shared relcache init file was never invalidated while running. That means that for such tables (e.g. pg_authid, pg_database) it's not just already existing sessions that are affected, but even new connections are as well. That explains why the reports usually were about pg_authid et. al.To fix 1), revalidate the rd_rel portion of a relcache entry wheninvalid. This implies a bit of extra complexity to deal withbootstrapping, but it's not too bad. The fix for 2) is simpler,simply always remove both the shared and local init files.Author: Andres FreundReviewed-By: Alvaro HerreraDiscussion:https://postgr.es/m/20180525203736.crkbg36muzxrjj5e@alap3.anarazel.dehttps://postgr.es/m/CAMa1XUhKSJd98JW4o9StWPrfS=11bPgG+_GDMxe25TvUY4Sugg@mail.gmail.comhttps://postgr.es/m/CAKMFJucqbuoDRfxPDX39WhA3vJyxweRg_zDVXzncr6+5wOguWA@mail.gmail.comhttps://postgr.es/m/CAGewt-ujGpMLQ09gXcUFMZaZsGJC98VXHEFbF-tpPB0fB13K+A@mail.gmail.comBackpatch: 9.3-1 parent8a07ebb commita54e1f1
File tree
3 files changed
+146
-75
lines changed- src
- backend/utils/cache
- include/storage
3 files changed
+146
-75
lines changedLines changed: 20 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
521 | 521 |
| |
522 | 522 |
| |
523 | 523 |
| |
524 |
| - | |
525 |
| - | |
526 |
| - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
527 | 528 |
| |
528 |
| - | |
529 |
| - | |
| 529 | + | |
530 | 530 |
| |
531 | 531 |
| |
532 | 532 |
| |
| |||
881 | 881 |
| |
882 | 882 |
| |
883 | 883 |
| |
| 884 | + | |
| 885 | + | |
| 886 | + | |
884 | 887 |
| |
885 |
| - | |
886 |
| - | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
887 | 891 |
| |
888 | 892 |
| |
889 | 893 |
| |
890 |
| - | |
891 |
| - | |
892 |
| - | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
893 | 897 |
| |
894 |
| - | |
895 |
| - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
896 | 904 |
| |
897 | 905 |
| |
898 | 906 |
| |
|
Lines changed: 125 additions & 62 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
250 | 250 |
| |
251 | 251 |
| |
252 | 252 |
| |
| 253 | + | |
253 | 254 |
| |
254 | 255 |
| |
255 | 256 |
| |
| |||
286 | 287 |
| |
287 | 288 |
| |
288 | 289 |
| |
289 |
| - | |
| 290 | + | |
290 | 291 |
| |
291 | 292 |
| |
292 | 293 |
| |
| |||
1931 | 1932 |
| |
1932 | 1933 |
| |
1933 | 1934 |
| |
1934 |
| - | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
1935 | 1945 |
| |
1936 | 1946 |
| |
1937 | 1947 |
| |
| |||
2135 | 2145 |
| |
2136 | 2146 |
| |
2137 | 2147 |
| |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
2138 | 2223 |
| |
2139 | 2224 |
| |
2140 | 2225 |
| |
| |||
2250 | 2335 |
| |
2251 | 2336 |
| |
2252 | 2337 |
| |
2253 |
| - | |
2254 |
| - | |
2255 |
| - | |
2256 |
| - | |
2257 |
| - | |
2258 |
| - | |
2259 |
| - | |
2260 |
| - | |
2261 |
| - | |
| 2338 | + | |
| 2339 | + | |
2262 | 2340 |
| |
2263 | 2341 |
| |
2264 | 2342 |
| |
2265 |
| - | |
2266 |
| - | |
2267 |
| - | |
2268 |
| - | |
2269 |
| - | |
2270 |
| - | |
2271 |
| - | |
2272 |
| - | |
2273 |
| - | |
| 2343 | + | |
2274 | 2344 |
| |
2275 | 2345 |
| |
2276 | 2346 |
| |
| |||
5907 | 5977 |
| |
5908 | 5978 |
| |
5909 | 5979 |
| |
5910 |
| - | |
| 5980 | + | |
5911 | 5981 |
| |
5912 | 5982 |
| |
5913 | 5983 |
| |
5914 |
| - | |
5915 |
| - | |
5916 |
| - | |
5917 |
| - | |
5918 |
| - | |
5919 |
| - | |
5920 |
| - | |
| 5984 | + | |
| 5985 | + | |
| 5986 | + | |
5921 | 5987 |
| |
5922 | 5988 |
| |
5923 | 5989 |
| |
5924 | 5990 |
| |
5925 |
| - | |
| 5991 | + | |
| 5992 | + | |
| 5993 | + | |
| 5994 | + | |
5926 | 5995 |
| |
5927 |
| - | |
| 5996 | + | |
| 5997 | + | |
| 5998 | + | |
| 5999 | + | |
5928 | 6000 |
| |
5929 | 6001 |
| |
5930 | 6002 |
| |
| |||
5994 | 6066 |
| |
5995 | 6067 |
| |
5996 | 6068 |
| |
5997 |
| - | |
5998 |
| - | |
5999 |
| - | |
6000 |
| - | |
6001 |
| - | |
6002 |
| - | |
6003 |
| - | |
6004 | 6069 |
| |
6005 | 6070 |
| |
6006 | 6071 |
| |
6007 | 6072 |
| |
6008 |
| - | |
| 6073 | + | |
| 6074 | + | |
6009 | 6075 |
| |
6010 |
| - | |
6011 |
| - | |
| 6076 | + | |
| 6077 | + | |
| 6078 | + | |
| 6079 | + | |
| 6080 | + | |
6012 | 6081 |
| |
6013 | 6082 |
| |
6014 | 6083 |
| |
6015 |
| - | |
6016 |
| - | |
6017 |
| - | |
6018 |
| - | |
6019 |
| - | |
6020 |
| - | |
6021 |
| - | |
6022 |
| - | |
6023 |
| - | |
6024 |
| - | |
6025 |
| - | |
6026 |
| - | |
6027 |
| - | |
6028 |
| - | |
| 6084 | + | |
| 6085 | + | |
| 6086 | + | |
| 6087 | + | |
| 6088 | + | |
| 6089 | + | |
| 6090 | + | |
| 6091 | + | |
| 6092 | + | |
6029 | 6093 |
| |
6030 | 6094 |
| |
6031 | 6095 |
| |
| |||
6051 | 6115 |
| |
6052 | 6116 |
| |
6053 | 6117 |
| |
6054 |
| - | |
6055 |
| - | |
6056 |
| - | |
6057 |
| - | |
6058 | 6118 |
| |
6059 | 6119 |
| |
6060 |
| - | |
| 6120 | + | |
6061 | 6121 |
| |
6062 | 6122 |
| |
6063 | 6123 |
| |
| |||
6097 | 6157 |
| |
6098 | 6158 |
| |
6099 | 6159 |
| |
6100 |
| - | |
| 6160 | + | |
6101 | 6161 |
| |
6102 | 6162 |
| |
6103 | 6163 |
| |
6104 | 6164 |
| |
6105 | 6165 |
| |
6106 | 6166 |
| |
6107 | 6167 |
| |
6108 |
| - | |
| 6168 | + | |
6109 | 6169 |
| |
6110 | 6170 |
| |
6111 | 6171 |
| |
6112 | 6172 |
| |
6113 | 6173 |
| |
6114 |
| - | |
| 6174 | + | |
| 6175 | + | |
| 6176 | + | |
| 6177 | + | |
6115 | 6178 |
| |
6116 | 6179 |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
64 | 64 |
| |
65 | 65 |
| |
66 | 66 |
| |
67 |
| - | |
| 67 | + | |
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
|
0 commit comments
Comments
(0)