forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit54eff53
committed
Fix deadlock hazard in CREATE INDEX CONCURRENTLY
Multiple sessions doing CREATE INDEX CONCURRENTLY simultaneously aresupposed to be able to work in parallel, as evidenced by fixes in commitc3d09b3 specifically to support this case. In reality, one of thesessions would be aborted by a misterious "deadlock detected" error.Jeff Janes diagnosed that this is because of leftover snapshots used forsystem catalog scans -- this was broken by8aa3e47 keeping track of(registering) the catalog snapshot. To fix the deadlocks, it's enoughto de-register that snapshot prior to waiting.Backpatch to 9.4, which introduced MVCC catalog scans.Include an isolationtester spec that 8 out of 10 times reproduces thedeadlock with the unpatched code for me (Álvaro).Author: Jeff JanesDiagnosed-by: Jeff JanesReported-by: Jeremy FinzelDiscussion:https://postgr.es/m/CAMa1XUhHjCv8Qkx0WOr1Mpm_R4qxN26EibwCrj0Oor2YBUFUTg%40mail.gmail.com1 parent4380362 commit54eff53
File tree
4 files changed
+63
-0
lines changed- src
- backend/commands
- test/isolation
- expected
- specs
4 files changed
+63
-0
lines changedLines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
856 | 856 |
| |
857 | 857 |
| |
858 | 858 |
| |
| 859 | + | |
| 860 | + | |
859 | 861 |
| |
860 | 862 |
| |
861 | 863 |
| |
862 | 864 |
| |
863 | 865 |
| |
| 866 | + | |
864 | 867 |
| |
865 | 868 |
| |
866 | 869 |
| |
|
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
| 58 | + | |
58 | 59 |
| |
59 | 60 |
| |
60 | 61 |
| |
|
Lines changed: 40 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + |
0 commit comments
Comments
(0)