forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6c6d6ba

Amit Kapila
Fix the Drop Database hang.
The drop database command waits for the logical replication sync worker toaccept ProcSignalBarrier and the worker's slot creation waits for the dropdatabase to finish which leads to a deadlock. This happens because thetablesync worker holds interrupts while creating a slot.We prevent cancel/die interrupts while creating a slot in the table syncworker because it is possible that before the server finishes thiscommand, a concurrent drop subscription happens which would completewithout removing this slot and that leads to the slot existing until theend of walsender. However, the slot will eventually get dropped at thewalsender exit time, so there is no danger of the dangling slot.This patch reallows cancel/die interrupts while creating a slot andmodifies the test to wait for slots to become zero to prevent finding anephemeral slot.The reported hang doesn't happen in PG14 as the drop database starts towait for ProcSignalBarrier with PG15 (commits4eb2176 ande2f65f4)but it is good to backpatch this till PG14 as it is not a good idea toprevent interrupts during a network call that could block indefinitely.Reported-by: Lakshmi Narayanan SreetharDiagnosed-by: Andres FreundAuthor: Hou ZhijieReviewed-by: Vignesh C, Amit KapilaBackpatch-through: 14, where it was introduced in commit6b67d72Discussion:https://postgr.es/m/CA+kvmZELXQ4ZD3U=XCXuG3KvFgkuPoN1QrEj8c-rMRodrLOnsg@mail.gmail.com1 parent728f86f commit6c6d6ba
File tree
2 files changed
+7
-10
lines changed- src
- backend/replication/logical
- test/subscription/t
2 files changed
+7
-10
lines changedLines changed: 0 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1396 | 1396 |
| |
1397 | 1397 |
| |
1398 | 1398 |
| |
1399 |
| - | |
1400 |
| - | |
1401 |
| - | |
1402 |
| - | |
1403 |
| - | |
1404 | 1399 |
| |
1405 |
| - | |
1406 | 1400 |
| |
1407 | 1401 |
| |
1408 | 1402 |
| |
1409 |
| - | |
1410 | 1403 |
| |
1411 | 1404 |
| |
1412 | 1405 |
| |
|
Lines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
166 |
| - | |
167 |
| - | |
168 |
| - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
169 | 173 |
| |
170 | 174 |
| |
171 | 175 |
| |
|
0 commit comments
Comments
(0)