Commit 52f1d67
committed
Fix memory counter update in ReorderBuffer.
Commit 5bec1d6 changed the memory usage updates of the
ReorderBufferTXN to zero all at once by subtracting txn->size, rather
than updating it for each change. However, if TOAST reconstruction
data remained in the transaction when freeing it, there were cases
where it further subtracted the memory counter from zero, resulting in
an assertion failure.
This change calculates the memory size for each change and updates the
memory usage to precisely the amount that has been freed.
Backpatch to v17, where this was introducd.
Reviewed-by: Amit Kapila, Shlok Kyal
Discussion: https://postgr.es/m/CAD21AoAqkNUvicgKPT_dXzNoOwpPkVTg0QPPxEcWmzT0moCJ1g%40mail.gmail.com
Backpatch-through: 171 parent 09a8407 commit 52f1d67
File tree
3 files changed
+62
-4
lines changed- contrib/test_decoding
- expected
- sql
- src/backend/replication/logical
3 files changed
+62
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
112 | 131 | | |
113 | 132 | | |
114 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
47 | 62 | | |
48 | 63 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
470 | 473 | | |
471 | 474 | | |
472 | 475 | | |
| |||
1506 | 1509 | | |
1507 | 1510 | | |
1508 | 1511 | | |
| 1512 | + | |
1509 | 1513 | | |
1510 | 1514 | | |
1511 | 1515 | | |
| |||
1535 | 1539 | | |
1536 | 1540 | | |
1537 | 1541 | | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
1538 | 1550 | | |
1539 | 1551 | | |
1540 | 1552 | | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
1541 | 1556 | | |
1542 | 1557 | | |
1543 | 1558 | | |
| |||
1594 | 1609 | | |
1595 | 1610 | | |
1596 | 1611 | | |
1597 | | - | |
1598 | | - | |
1599 | | - | |
1600 | 1612 | | |
1601 | 1613 | | |
1602 | 1614 | | |
| |||
1616 | 1628 | | |
1617 | 1629 | | |
1618 | 1630 | | |
| 1631 | + | |
1619 | 1632 | | |
1620 | 1633 | | |
1621 | 1634 | | |
| |||
1648 | 1661 | | |
1649 | 1662 | | |
1650 | 1663 | | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
1651 | 1672 | | |
1652 | 1673 | | |
1653 | 1674 | | |
1654 | 1675 | | |
1655 | | - | |
| 1676 | + | |
1656 | 1677 | | |
1657 | 1678 | | |
1658 | 1679 | | |
| |||
2062 | 2083 | | |
2063 | 2084 | | |
2064 | 2085 | | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
2065 | 2089 | | |
2066 | 2090 | | |
2067 | 2091 | | |
| |||
0 commit comments