forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf8d3018
committed
Fix predicate-locking of HOT updated rows.
In serializable mode, heap_hot_search_buffer() incorrectly acquired apredicate lock on the root tuple, not the returned tuple that satisfiedthe visibility checks. As explained in README-SSI, the predicate lock doesnot need to be copied or extended to other tuple versions, but for that towork, the correct, visible, tuple version must be locked in the firstplace.The original SSI commit had this bug in it, but it was fixed back in 2013,in commit81fbbfe. But unfortunately, it was reintroduced a few monthslater in commitb89e151. Wising up from that, add a regression testto cover this, so that it doesn't get reintroduced again. Also, move thecode that sets 't_self', so that it happens at the same time that theother HeapTuple fields are set, to make it more clear that all the code inthe loop operate on the "current" tuple in the chain, not the root tuple.Bug spotted by Andres Freund, analysis and original fix by Thomas Munro,test case and some additional changes to the fix by Heikki Linnakangas.Backpatch to all supported versions (9.4).Discussion:https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de1 parentd8652ec commitf8d3018
File tree
4 files changed
+70
-17
lines changed- src
- backend/access/heap
- test/isolation
- expected
- specs
4 files changed
+70
-17
lines changedLines changed: 12 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1529 | 1529 |
| |
1530 | 1530 |
| |
1531 | 1531 |
| |
| 1532 | + | |
1532 | 1533 |
| |
1533 | 1534 |
| |
1534 | 1535 |
| |
| |||
1538 | 1539 |
| |
1539 | 1540 |
| |
1540 | 1541 |
| |
1541 |
| - | |
1542 |
| - | |
1543 |
| - | |
| 1542 | + | |
1544 | 1543 |
| |
1545 | 1544 |
| |
1546 | 1545 |
| |
1547 | 1546 |
| |
1548 |
| - | |
| 1547 | + | |
| 1548 | + | |
1549 | 1549 |
| |
1550 | 1550 |
| |
1551 | 1551 |
| |
| |||
1573 | 1573 |
| |
1574 | 1574 |
| |
1575 | 1575 |
| |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
1576 | 1582 |
| |
1577 | 1583 |
| |
1578 | 1584 |
| |
1579 |
| - | |
| 1585 | + | |
1580 | 1586 |
| |
1581 | 1587 |
| |
1582 | 1588 |
| |
| |||
1602 | 1608 |
| |
1603 | 1609 |
| |
1604 | 1610 |
| |
1605 |
| - | |
1606 |
| - | |
1607 |
| - | |
1608 |
| - | |
1609 |
| - | |
1610 |
| - | |
1611 |
| - | |
1612 |
| - | |
1613 |
| - | |
1614 | 1611 |
| |
1615 | 1612 |
| |
1616 | 1613 |
| |
1617 | 1614 |
| |
1618 |
| - | |
1619 |
| - | |
1620 | 1615 |
| |
1621 | 1616 |
| |
1622 | 1617 |
| |
| |||
1648 | 1643 |
| |
1649 | 1644 |
| |
1650 | 1645 |
| |
1651 |
| - | |
| 1646 | + | |
1652 | 1647 |
| |
1653 | 1648 |
| |
1654 | 1649 |
| |
|
Lines changed: 20 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 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| 20 | + | |
20 | 21 |
| |
21 | 22 |
| |
22 | 23 |
| |
|
Lines changed: 37 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 | + |
0 commit comments
Comments
(0)