forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6310809
committed
Fix check for conflicting session- vs transaction-level locks.
We have an implementation restriction that PREPARE TRANSACTION can'thandle cases where both session-lifespan and transaction-lifespan locksare held on the same lockable object. (That's because we'd otherwiseneed to acquire a new PROCLOCK entry during post-prepare cleanup, whichis an operation that might fail. The situation can only arise with oddusages of advisory locks, so removing the restriction is probably notworth the amount of effort it would take.) AtPrepare_Locks attemptedto enforce this, but its logic was many bricks shy of a load, becauseit only detected cases where the session and transaction locks had thesame lockmode. Locks of different modes on the same object would leadto the rather unhelpful message "PANIC: we seem to have dropped a bitsomewhere".To fix, build a transient hashtable with one entry per locktag,not one per locktag + mode, and use that to detect conflicts.Per bug #17122 from Alexander Pyhalov. This bug is ancient,so back-patch to all supported branches.Discussion:https://postgr.es/m/17122-04f3c32098a62233@postgresql.org1 parent3779ac6 commit6310809
File tree
4 files changed
+144
-24
lines changed- src
- backend/storage/lmgr
- test/regress
- expected
- sql
4 files changed
+144
-24
lines changedLines changed: 105 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
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 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
3207 | 3303 |
| |
3208 | 3304 |
| |
3209 | 3305 |
| |
3210 | 3306 |
| |
3211 | 3307 |
| |
3212 | 3308 |
| |
3213 | 3309 |
| |
3214 |
| - | |
3215 |
| - | |
3216 |
| - | |
3217 |
| - | |
3218 |
| - | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
3219 | 3314 |
| |
3220 | 3315 |
| |
3221 | 3316 |
| |
3222 | 3317 |
| |
3223 | 3318 |
| |
3224 | 3319 |
| |
3225 | 3320 |
| |
3226 |
| - | |
3227 |
| - | |
3228 |
| - | |
3229 |
| - | |
3230 |
| - | |
3231 |
| - | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
3232 | 3325 |
| |
3233 | 3326 |
| |
3234 | 3327 |
| |
| |||
3264 | 3357 |
| |
3265 | 3358 |
| |
3266 | 3359 |
| |
3267 |
| - | |
3268 |
| - | |
3269 |
| - | |
3270 |
| - | |
3271 |
| - | |
3272 |
| - | |
3273 |
| - | |
3274 |
| - | |
3275 |
| - | |
3276 |
| - | |
3277 |
| - | |
3278 |
| - | |
3279 |
| - | |
| 3360 | + | |
3280 | 3361 |
| |
3281 | 3362 |
| |
3282 | 3363 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
154 | 170 |
| |
155 | 171 |
| |
156 | 172 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
156 | 173 |
| |
157 | 174 |
| |
158 | 175 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
91 | 97 |
| |
92 | 98 |
| |
93 | 99 |
| |
|
0 commit comments
Comments
(0)