- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit246a6c8
committed
Make autovacuum more aggressive to remove orphaned temp tables
Commitdafa084, added in 10, made the removal of temporary orphanedtables more aggressive. This commit makes an extra step into theaggressiveness by adding a flag in each backend's MyProc which tracksdown any temporary namespace currently in use. The flag is set when thenamespace gets created and can be reset if the temporary namespace hasbeen created in a transaction or sub-transaction which is aborted. Theflag value assignment is assumed to be atomic, so this can be done in alock-less fashion like other flags already present in PGPROC likedatabaseId or backendId, still the fact that the temporary namespace andtable created are still locked until the transaction creating thosecommits acts as a barrier for other backends.This new flag gets used by autovacuum to discard more aggressivelyorphaned tables by additionally checking for the database a backend isconnected to as well as its temporary namespace in-use, removingorphaned temporary relations even if a backend reuses the same slot asone which created temporary relations in a past session.The base idea of this patch comes from Robert Haas, has been written inits first version by Tsunakawa Takayuki, then heavily reviewed by me.Author: Tsunakawa TakayukiReviewed-by: Michael Paquier, Kyotaro Horiguchi, Andres FreundDiscussion:https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8A4DC6@G01JPEXMBYT05Backpatch: 11-, as PGPROC gains a new flag and we don't want silent ABIbreakages on already released versions.1 parent4f9a97e commit246a6c8
File tree
6 files changed
+83
-14
lines changed- src
- backend
- access/transam
- catalog
- postmaster
- storage/lmgr
- include
- catalog
- storage
6 files changed
+83
-14
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
471 | 471 |
| |
472 | 472 |
| |
473 | 473 |
| |
| 474 | + | |
474 | 475 |
| |
475 | 476 |
| |
476 | 477 |
| |
|
Lines changed: 69 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
50 |
| - | |
| 50 | + | |
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
| |||
3204 | 3204 |
| |
3205 | 3205 |
| |
3206 | 3206 |
| |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
3207 | 3247 |
| |
3208 | 3248 |
| |
3209 | 3249 |
| |
| |||
3893 | 3933 |
| |
3894 | 3934 |
| |
3895 | 3935 |
| |
| 3936 | + | |
| 3937 | + | |
| 3938 | + | |
| 3939 | + | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
| 3945 | + | |
3896 | 3946 |
| |
3897 | 3947 |
| |
3898 | 3948 |
| |
| |||
3923 | 3973 |
| |
3924 | 3974 |
| |
3925 | 3975 |
| |
| 3976 | + | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
| 3984 | + | |
3926 | 3985 |
| |
3927 | 3986 |
| |
3928 | 3987 |
| |
| |||
3975 | 4034 |
| |
3976 | 4035 |
| |
3977 | 4036 |
| |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
3978 | 4046 |
| |
3979 | 4047 |
| |
3980 | 4048 |
| |
|
Lines changed: 7 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2080 | 2080 |
| |
2081 | 2081 |
| |
2082 | 2082 |
| |
2083 |
| - | |
2084 |
| - | |
2085 |
| - | |
2086 |
| - | |
2087 |
| - | |
2088 |
| - | |
2089 |
| - | |
2090 |
| - | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
2091 | 2088 |
| |
2092 | 2089 |
| |
2093 | 2090 |
| |
| |||
2215 | 2212 |
| |
2216 | 2213 |
| |
2217 | 2214 |
| |
2218 |
| - | |
2219 | 2215 |
| |
2220 | 2216 |
| |
2221 | 2217 |
| |
| |||
2257 | 2253 |
| |
2258 | 2254 |
| |
2259 | 2255 |
| |
2260 |
| - | |
2261 |
| - | |
2262 |
| - | |
2263 |
| - | |
| 2256 | + | |
| 2257 | + | |
2264 | 2258 |
| |
2265 | 2259 |
| |
2266 | 2260 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
371 | 371 |
| |
372 | 372 |
| |
373 | 373 |
| |
| 374 | + | |
374 | 375 |
| |
375 | 376 |
| |
376 | 377 |
| |
| |||
552 | 553 |
| |
553 | 554 |
| |
554 | 555 |
| |
| 556 | + | |
555 | 557 |
| |
556 | 558 |
| |
557 | 559 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
| 140 | + | |
140 | 141 |
| |
141 | 142 |
| |
142 | 143 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
114 | 114 |
| |
115 | 115 |
| |
116 | 116 |
| |
| 117 | + | |
| 118 | + | |
| 119 | + | |
117 | 120 |
| |
118 | 121 |
| |
119 | 122 |
| |
|
0 commit comments
Comments
(0)