forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd3ff180
committed
Fix a longstanding bug in VACUUM FULL's handling of update chains. The code
did not expect that a DEAD tuple could follow a RECENTLY_DEAD tuple in anupdate chain, but because the OldestXmin rule for determining deadness is asimplification of reality, it is possible for this situation to occur(implying that the RECENTLY_DEAD tuple is in fact dead to all observers,but this patch does not attempt to exploit that). The code would follow achain forward all the way, but then stop before a DEAD tuple when backingup, meaning that not all of the chain got moved. This could lead to copyingthe chain multiple times (resulting in duplicate copies of the live tuple atits end), or leaving dangling index entries behind (which, aside fromgenerating warnings from later vacuums, creates a risk of wrong queryresults or bogus duplicate-key errors once the heap slot the index entrypoints to is repopulated).The fix is to recheck HeapTupleSatisfiesVacuum while following a chainforward, and to stop if a DEAD tuple is reached. Each contiguous groupof RECENTLY_DEAD tuples will therefore be copied as a separate chain.The patch also adds a couple of extra sanity checks to verify correctbehavior.Per report and test case from Pavan Deolasee.1 parent0169c35 commitd3ff180
1 file changed
+44
-2
lines changedLines changed: 44 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
16 |
| - | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| |||
1880 | 1880 |
| |
1881 | 1881 |
| |
1882 | 1882 |
| |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
1883 | 1892 |
| |
1884 | 1893 |
| |
1885 | 1894 |
| |
| |||
1892 | 1901 |
| |
1893 | 1902 |
| |
1894 | 1903 |
| |
| 1904 | + | |
1895 | 1905 |
| |
1896 | 1906 |
| |
1897 | 1907 |
| |
| |||
1919 | 1929 |
| |
1920 | 1930 |
| |
1921 | 1931 |
| |
1922 |
| - | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
1923 | 1939 |
| |
1924 | 1940 |
| |
1925 | 1941 |
| |
| |||
1933 | 1949 |
| |
1934 | 1950 |
| |
1935 | 1951 |
| |
| 1952 | + | |
1936 | 1953 |
| |
1937 | 1954 |
| |
1938 | 1955 |
| |
| |||
1963 | 1980 |
| |
1964 | 1981 |
| |
1965 | 1982 |
| |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
1966 | 1996 |
| |
1967 | 1997 |
| |
1968 | 1998 |
| |
| |||
2034 | 2064 |
| |
2035 | 2065 |
| |
2036 | 2066 |
| |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
2037 | 2072 |
| |
2038 | 2073 |
| |
2039 | 2074 |
| |
| |||
2102 | 2137 |
| |
2103 | 2138 |
| |
2104 | 2139 |
| |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
2105 | 2147 |
| |
2106 | 2148 |
| |
2107 | 2149 |
| |
|
0 commit comments
Comments
(0)