forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8bbe4cb
committed
Improve contrib/pg_stat_statements' handling of garbage collection failure.
If we can't read the query texts file (whether because out-of-memory, orfor some other reason), give up and reset the file to empty, discarding allstored query texts, though not the statistics per se. We used to leavethings alone and hope for better luck next time, but the problem is thatthe file is only going to get bigger and even harder to slurp into memory.Better to do something that will get us out of trouble.Likewise reset the file to empty for any other failure within gc_qtexts().The previous behavior after a write error was to discard query texts butnot do anything to truncate the file, which is just weird.Also, increase the maximum supported file size from MaxAllocSize toMaxAllocHugeSize; this makes it more likely we'll be able to do a garbagecollection successfully.Also, fix recalculation of mean_query_len within entry_dealloc() to matchthe calculation in gc_qtexts(). The previous coding overlooked thepossibility of dropped texts (query_len == -1) and would underestimate themean of the remaining entries in such cases, thus possibly causing excessgarbage collection cycles.In passing, add some errdetail to the log entry that complains aboutinsufficient memory to read the query texts file, which after all wasJim Nasby's original complaint.Back-patch to 9.4 where the current handling of query texts wasintroduced.Peter Geoghegan, rather editorialized upon by me1 parent86b1e67 commit8bbe4cb
1 file changed
+75
-18
lines changedLines changed: 75 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
173 |
| - | |
| 173 | + | |
174 | 174 |
| |
175 | 175 |
| |
176 | 176 |
| |
| |||
1705 | 1705 |
| |
1706 | 1706 |
| |
1707 | 1707 |
| |
1708 |
| - | |
| 1708 | + | |
| 1709 | + | |
1709 | 1710 |
| |
1710 | 1711 |
| |
1711 | 1712 |
| |
| |||
1716 | 1717 |
| |
1717 | 1718 |
| |
1718 | 1719 |
| |
1719 |
| - | |
| 1720 | + | |
| 1721 | + | |
1720 | 1722 |
| |
1721 | 1723 |
| |
1722 | 1724 |
| |
1723 | 1725 |
| |
1724 |
| - | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
1725 | 1733 |
| |
1726 | 1734 |
| |
1727 | 1735 |
| |
1728 | 1736 |
| |
1729 | 1737 |
| |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1730 | 1741 |
| |
1731 | 1742 |
| |
1732 | 1743 |
| |
| |||
1736 | 1747 |
| |
1737 | 1748 |
| |
1738 | 1749 |
| |
1739 |
| - | |
1740 |
| - | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
1741 | 1756 |
| |
1742 | 1757 |
| |
| 1758 | + | |
1743 | 1759 |
| |
1744 | 1760 |
| |
| 1761 | + | |
1745 | 1762 |
| |
1746 |
| - | |
1747 |
| - | |
1748 | 1763 |
| |
1749 |
| - | |
1750 |
| - | |
1751 |
| - | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
1752 | 1769 |
| |
| 1770 | + | |
1753 | 1771 |
| |
1754 | 1772 |
| |
1755 | 1773 |
| |
| |||
1892 | 1910 |
| |
1893 | 1911 |
| |
1894 | 1912 |
| |
1895 |
| - | |
| 1913 | + | |
1896 | 1914 |
| |
1897 | 1915 |
| |
1898 | 1916 |
| |
1899 | 1917 |
| |
1900 | 1918 |
| |
1901 | 1919 |
| |
1902 | 1920 |
| |
1903 |
| - | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
1904 | 1924 |
| |
1905 | 1925 |
| |
1906 | 1926 |
| |
| |||
2002 | 2022 |
| |
2003 | 2023 |
| |
2004 | 2024 |
| |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
2005 | 2029 |
| |
2006 | 2030 |
| |
2007 | 2031 |
| |
2008 | 2032 |
| |
2009 | 2033 |
| |
2010 | 2034 |
| |
2011 |
| - | |
| 2035 | + | |
2012 | 2036 |
| |
2013 | 2037 |
| |
2014 | 2038 |
| |
| |||
2023 | 2047 |
| |
2024 | 2048 |
| |
2025 | 2049 |
| |
2026 |
| - | |
2027 |
| - | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
2028 | 2055 |
| |
2029 | 2056 |
| |
2030 | 2057 |
| |
2031 |
| - | |
| 2058 | + | |
2032 | 2059 |
| |
2033 | 2060 |
| |
2034 | 2061 |
| |
| |||
2063 | 2090 |
| |
2064 | 2091 |
| |
2065 | 2092 |
| |
| 2093 | + | |
2066 | 2094 |
| |
2067 | 2095 |
| |
2068 | 2096 |
| |
| |||
2147 | 2175 |
| |
2148 | 2176 |
| |
2149 | 2177 |
| |
2150 |
| - | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
2151 | 2208 |
| |
2152 | 2209 |
| |
2153 | 2210 |
| |
|
0 commit comments
Comments
(0)