forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit358cde3
committed
Fix race condition that lead to WALInsertLock deadlock with commit_delay.
If a call to WaitForXLogInsertionsToFinish() returned a value in the middleof a page, and another backend then started to insert a record to the samepage, and then you called WaitXLogInsertionsToFinish() again, the secondcall might return a smaller value than the first call. The problem was inGetXLogBuffer(), which always updated the insertingAt value to thebeginning of the requested page, not the actual requested location. Becauseof that, the second call might return a xlog pointer to the beginning ofthe page, while the first one returned a later position on the same page.XLogFlush() performs two calls to WaitXLogInsertionsToFinish() insuccession, and holds WALWriteLock on the second call, which can deadlockif the second call to WaitXLogInsertionsToFinish() blocks.Reported by Spiros Ioannou. Backpatch to 9.4, where the more scalableWALInsertLock mechanism, and this bug, was introduced.1 parenta4b09af commit358cde3
1 file changed
+24
-3
lines changedLines changed: 24 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1664 | 1664 |
| |
1665 | 1665 |
| |
1666 | 1666 |
| |
| 1667 | + | |
| 1668 | + | |
1667 | 1669 |
| |
1668 |
| - | |
1669 |
| - | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
1670 | 1682 |
| |
1671 |
| - | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
1672 | 1693 |
| |
1673 | 1694 |
| |
1674 | 1695 |
| |
|
0 commit comments
Comments
(0)