forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitee5d1de
committed
In B-tree page deletion, clean up properly after page deletion failure.
In _bt_unlink_halfdead_page(), we might fail to find an immediate leftsibling of the target page, perhaps because of corruption of the pagesibling links. The code intends to cope with this by just abandoningthe deletion attempt; but what actually happens is that it fails outrightdue to releasing the same buffer lock twice. (And error recovery masksa second problem, which is possible leakage of a pin on another page.)Seems to have been introduced by careless refactoring in commitefada2b.Since there are multiple cases to consider, let's make releasing the bufferlock in the failure case the responsibility of _bt_unlink_halfdead_page()not its caller.Also, avoid fetching the leaf page's left-link again after we've droppedlock on the page. This is probably harmless, but it's not exactly goodcoding practice.Per report from Kyotaro Horiguchi. Back-patch to 9.4 where the faulty codewas introduced.Discussion: <20160803.173116.111915228.horiguchi.kyotaro@lab.ntt.co.jp>1 parentcae0d4f commitee5d1de
1 file changed
+23
-4
lines changedLines changed: 23 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1284 | 1284 |
| |
1285 | 1285 |
| |
1286 | 1286 |
| |
1287 |
| - | |
| 1287 | + | |
1288 | 1288 |
| |
1289 | 1289 |
| |
1290 | 1290 |
| |
| |||
1501 | 1501 |
| |
1502 | 1502 |
| |
1503 | 1503 |
| |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
1504 | 1509 |
| |
1505 | 1510 |
| |
1506 | 1511 |
| |
| |||
1543 | 1548 |
| |
1544 | 1549 |
| |
1545 | 1550 |
| |
1546 |
| - | |
| 1551 | + | |
| 1552 | + | |
1547 | 1553 |
| |
1548 | 1554 |
| |
1549 | 1555 |
| |
1550 | 1556 |
| |
| 1557 | + | |
1551 | 1558 |
| |
1552 | 1559 |
| |
1553 | 1560 |
| |
| |||
1567 | 1574 |
| |
1568 | 1575 |
| |
1569 | 1576 |
| |
1570 |
| - | |
| 1577 | + | |
1571 | 1578 |
| |
1572 | 1579 |
| |
1573 | 1580 |
| |
| |||
1598 | 1605 |
| |
1599 | 1606 |
| |
1600 | 1607 |
| |
1601 |
| - | |
| 1608 | + | |
| 1609 | + | |
1602 | 1610 |
| |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
1603 | 1622 |
| |
1604 | 1623 |
| |
1605 | 1624 |
| |
|
0 commit comments
Comments
(0)