forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commiteba7753
committed
Avoid amcheck inline compression false positives.
The previous tacit assumption that index_form_tuple() hides differencesin the TOAST state of its input datums was wrong. Normalize inputvarlena datums by decompressing compressed values, and forming a newindex tuple for fingerprinting using uncompressed inputs. The finalnormalized representation may actually be compressed once again withinindex_form_tuple(), though that shouldn't matter. When the originaltuple is found to have no datums that are compressed inline, fingerprintthe original tuple directly.Normalization avoids false positive reports of corruption in certaincases. For example, the executor can apply toasting with some inlinecompression to an entire heap tuple because its input has a singleexternal TOAST pointer. Varlena datums for other attributes that arenot particularly good candidates for inline compression can becompressed in the heap tuple in passing, without the representation ofthe same values in index tuples ever receiving concomitant inlinecompression.Add a test case to recreate the issue in a simpler though less realisticway: by exploiting differences in pg_attribute.attstorage between heapand index relations.This bug was discovered by me during testing of an upcoming set of nbtreeenhancements. It was also independently reported by Andreas Kunert, asbug #15597. His test case was rather more realistic than the one Iended up using.Bug: #15597Discussion:https://postgr.es/m/CAH2-WznrVd9ie+TTJ45nDT+v2nUt6YJwQrT9SebCdQKtAvfPZw@mail.gmail.comDiscussion:https://postgr.es/m/15597-294e5d3e7f01c407@postgresql.orgBackpatch: 11-, where heapallindexed verification was introduced.1 parent727921f commiteba7753
File tree
3 files changed
+162
-23
lines changed- contrib/amcheck
- expected
- sql
3 files changed
+162
-23
lines changedLines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
143 | 162 |
| |
144 | 163 |
| |
145 | 164 |
| |
146 | 165 |
| |
147 | 166 |
| |
| 167 | + | |
148 | 168 |
| |
149 | 169 |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
91 | 106 |
| |
92 | 107 |
| |
93 | 108 |
| |
94 | 109 |
| |
95 | 110 |
| |
| 111 | + | |
96 | 112 |
| |
97 | 113 |
|
Lines changed: 126 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
133 | 133 |
| |
134 | 134 |
| |
135 | 135 |
| |
| 136 | + | |
| 137 | + | |
136 | 138 |
| |
137 | 139 |
| |
138 | 140 |
| |
| |||
908 | 910 |
| |
909 | 911 |
| |
910 | 912 |
| |
911 |
| - | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
912 | 923 |
| |
913 | 924 |
| |
914 | 925 |
| |
| |||
1672 | 1683 |
| |
1673 | 1684 |
| |
1674 | 1685 |
| |
1675 |
| - | |
| 1686 | + | |
1676 | 1687 |
| |
1677 | 1688 |
| |
1678 | 1689 |
| |
1679 |
| - | |
1680 |
| - | |
1681 |
| - | |
1682 |
| - | |
1683 |
| - | |
1684 |
| - | |
1685 |
| - | |
1686 |
| - | |
1687 |
| - | |
1688 |
| - | |
1689 |
| - | |
1690 |
| - | |
1691 |
| - | |
1692 |
| - | |
1693 |
| - | |
1694 |
| - | |
1695 |
| - | |
1696 |
| - | |
1697 |
| - | |
| 1690 | + | |
1698 | 1691 |
| |
1699 | 1692 |
| |
| 1693 | + | |
1700 | 1694 |
| |
1701 | 1695 |
| |
1702 |
| - | |
1703 |
| - | |
| 1696 | + | |
| 1697 | + | |
1704 | 1698 |
| |
1705 | 1699 |
| |
1706 | 1700 |
| |
| |||
1714 | 1708 |
| |
1715 | 1709 |
| |
1716 | 1710 |
| |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 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 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
1717 | 1820 |
| |
1718 | 1821 |
| |
1719 | 1822 |
| |
|
0 commit comments
Comments
(0)