forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit80d76be
committed
Avoid failure if autovacuum tries to access a just-dropped temp namespace.
Such an access became possible when commit246a6c8 added moreaggressive cleanup of orphaned temp relations by autovacuum.Since autovacuum's snapshot might be slightly stale, it couldattempt to access an already-dropped temp namespace, resulting inan assertion failure or null-pointer dereference. (In practice,since we don't drop temp namespaces automatically but merelyrecycle them, this situation could only arise if a superuser doesa manual drop of a temp namespace. Still, that should be allowed.)The core of the bug, IMO, is that isTempNamespaceInUse and its callersfailed to think hard about whether to treat "temp namespace isn't there"differently from "temp namespace isn't in use". In hopes of forestallingfuture mistakes of the same ilk, replace that function with a new onecheckTempNamespaceStatus, which makes the same tests but returns athree-way enum rather than just a bool. isTempNamespaceInUse is goneentirely in HEAD; but just in case some external code is relying on it,keep it in the back branches, as a bug-compatible wrapper around thenew function.Per report originally from Prabhat Kumar Sahu, investigated by MahendraSingh and Michael Paquier; the final form of the patch is my fault.This replaces the failed fix attempt ina052f6c.Backpatch as far as v11, as246a6c8 was.Discussion:https://postgr.es/m/CAKYtNAr9Zq=1-ww4etHo-VCC-k120YxZy5OS01VkaLPaDbv2tg@mail.gmail.com1 parent32bb453 commit80d76be
File tree
3 files changed
+25
-14
lines changed- src
- backend
- catalog
- postmaster
- include/catalog
3 files changed
+25
-14
lines changedLines changed: 10 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3217 | 3217 |
| |
3218 | 3218 |
| |
3219 | 3219 |
| |
3220 |
| - | |
| 3220 | + | |
3221 | 3221 |
| |
3222 | 3222 |
| |
3223 | 3223 |
| |
3224 | 3224 |
| |
3225 | 3225 |
| |
3226 | 3226 |
| |
3227 | 3227 |
| |
3228 |
| - | |
3229 |
| - | |
| 3228 | + | |
| 3229 | + | |
3230 | 3230 |
| |
3231 | 3231 |
| |
3232 | 3232 |
| |
| |||
3235 | 3235 |
| |
3236 | 3236 |
| |
3237 | 3237 |
| |
3238 |
| - | |
| 3238 | + | |
3239 | 3239 |
| |
3240 |
| - | |
| 3240 | + | |
3241 | 3241 |
| |
3242 | 3242 |
| |
3243 | 3243 |
| |
3244 | 3244 |
| |
3245 |
| - | |
| 3245 | + | |
3246 | 3246 |
| |
3247 | 3247 |
| |
3248 | 3248 |
| |
3249 |
| - | |
| 3249 | + | |
3250 | 3250 |
| |
3251 | 3251 |
| |
3252 | 3252 |
| |
3253 |
| - | |
| 3253 | + | |
3254 | 3254 |
| |
3255 |
| - | |
3256 |
| - | |
| 3255 | + | |
| 3256 | + | |
3257 | 3257 |
| |
3258 | 3258 |
| |
3259 | 3259 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2071 | 2071 |
| |
2072 | 2072 |
| |
2073 | 2073 |
| |
2074 |
| - | |
| 2074 | + | |
| 2075 | + | |
2075 | 2076 |
| |
2076 |
| - | |
| 2077 | + | |
2077 | 2078 |
| |
2078 | 2079 |
| |
2079 | 2080 |
| |
| |||
2243 | 2244 |
| |
2244 | 2245 |
| |
2245 | 2246 |
| |
2246 |
| - | |
| 2247 | + | |
2247 | 2248 |
| |
2248 | 2249 |
| |
2249 | 2250 |
| |
|
Lines changed: 11 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 |
| |
41 | 51 |
| |
42 | 52 |
| |
| |||
138 | 148 |
| |
139 | 149 |
| |
140 | 150 |
| |
141 |
| - | |
| 151 | + | |
142 | 152 |
| |
143 | 153 |
| |
144 | 154 |
| |
|
0 commit comments
Comments
(0)