- Notifications
You must be signed in to change notification settings - Fork5
Commit27336e4
committed
Repair race condition introduced into heap_update() in 7.1 ---
PageGetFreeSpace() was being called while not holding the buffer lock, whichnot only could yield a garbage answer, but even if it's the right answer theremight be less space available after we reacquire the buffer lock.Also repair potential deadlock introduced by my recent performance improvementin RelationGetBufferForTuple(): it was possible for two heap_updates to try tolock two buffers in opposite orders. The fix creates a global rule thatbuffers of a single heap relation should be locked in decreasing block numberorder. Currently, this only applies to heap_update; VACUUM can get away withignoring the rule since it holds exclusive lock on the whole relation anyway.However, if we try to implement a VACUUM that can run in parallel with othertransactions, VACUUM will also have to obey the lock order rule.1 parentae38a1f commit27336e4
3 files changed
+116
-47
lines changedLines changed: 64 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
1317 | 1317 |
| |
1318 | 1318 |
| |
1319 | 1319 |
| |
1320 |
| - | |
| 1320 | + | |
1321 | 1321 |
| |
1322 | 1322 |
| |
1323 | 1323 |
| |
| |||
1578 | 1578 |
| |
1579 | 1579 |
| |
1580 | 1580 |
| |
| 1581 | + | |
| 1582 | + | |
1581 | 1583 |
| |
1582 | 1584 |
| |
1583 | 1585 |
| |
| |||
1685 | 1687 |
| |
1686 | 1688 |
| |
1687 | 1689 |
| |
1688 |
| - | |
1689 |
| - | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
1690 | 1694 |
| |
1691 | 1695 |
| |
1692 | 1696 |
| |
| |||
1704 | 1708 |
| |
1705 | 1709 |
| |
1706 | 1710 |
| |
| 1711 | + | |
1707 | 1712 |
| |
| 1713 | + | |
| 1714 | + | |
1708 | 1715 |
| |
1709 |
| - | |
1710 |
| - | |
1711 |
| - | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1712 | 1741 |
| |
1713 |
| - | |
1714 |
| - | |
1715 |
| - | |
1716 |
| - | |
1717 |
| - | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
1718 | 1765 |
| |
1719 | 1766 |
| |
1720 | 1767 |
| |
| |||
1723 | 1770 |
| |
1724 | 1771 |
| |
1725 | 1772 |
| |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
1726 | 1778 |
| |
1727 | 1779 |
| |
1728 | 1780 |
| |
|
Lines changed: 49 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
66 | 66 |
| |
67 | 67 |
| |
68 | 68 |
| |
69 |
| - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
70 | 72 |
| |
71 |
| - | |
72 |
| - | |
73 |
| - | |
74 |
| - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
75 | 76 |
| |
76 |
| - | |
77 |
| - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 |
| |
79 | 85 |
| |
80 |
| - | |
| 86 | + | |
| 87 | + | |
81 | 88 |
| |
82 | 89 |
| |
83 | 90 |
| |
| |||
103 | 110 |
| |
104 | 111 |
| |
105 | 112 |
| |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
116 | 126 |
| |
117 | 127 |
| |
118 | 128 |
| |
| |||
137 | 147 |
| |
138 | 148 |
| |
139 | 149 |
| |
140 |
| - | |
| 150 | + | |
141 | 151 |
| |
142 | 152 |
| |
143 | 153 |
| |
144 | 154 |
| |
145 | 155 |
| |
146 | 156 |
| |
147 |
| - | |
148 |
| - | |
149 |
| - | |
150 |
| - | |
| 157 | + | |
151 | 158 |
| |
152 |
| - | |
153 |
| - | |
154 |
| - | |
155 |
| - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
156 | 174 |
| |
157 |
| - | |
158 |
| - | |
159 |
| - | |
160 |
| - | |
161 |
| - | |
162 | 175 |
| |
163 | 176 |
| |
164 | 177 |
| |
165 | 178 |
| |
| 179 | + | |
| 180 | + | |
| 181 | + | |
166 | 182 |
| |
167 | 183 |
| |
168 | 184 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
21 |
| - | |
| 21 | + | |
| 22 | + | |
22 | 23 |
| |
23 | 24 |
|
0 commit comments
Comments
(0)