forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit72a98a6
committed
Don't open formally non-existent segments in _mdfd_getseg().
Before this commit _mdfd_getseg(), in contrast to mdnblocks(), did notverify whether all segments leading up to the to-be-opened one, wereRELSEG_SIZE sized. That is e.g. not the case after truncating arelation, because later segments just get truncated to zero length, notremoved.Once a "non-existent" segment has been opened in a session, mdnblocks()will return wrong results, causing errors like "could not read block %uin file" when accessing blocks. Closing the session, or the laterarrival of relevant invalidation messages, would "fix" the problem.That, so far, was mostly harmless, because most segment accesses areonly done after an mdnblocks() call. But since428b1d6 we try toopen segments that might have been deleted, to trigger kernel writebackfrom a backend's queue of recent writes.To fix check segment sizes in _mdfd_getseg() when opening previouslyunopened segments. In practice this shouldn't imply a lot of additionallseek() calls, because mdnblocks() will most of the time already haveopened all relevant segments.This commit also fixes a second problem, namely that _mdfd_getseg(EXTENSION_RETURN_NULL) extends files during recovery, which is notdesirable for the mdwriteback() case. Add EXTENSION_REALLY_RETURN_NULL,which does not behave that way, and use it.Reported-By: Thom BrownAuthor: Andres Freund, Abhijit Menon-SenReviewd-By: Robert Haas, Fabien CoehloDiscussion: CAA-aLv6Dp_ZsV-44QA-2zgkqWKQq=GedBX2dRSrWpxqovXK=Pg@mail.gmail.comFixes:428b1d61 parentc6ff84b commit72a98a6
1 file changed
+69
-27
lines changedLines changed: 69 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
168 |
| - | |
169 |
| - | |
170 |
| - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
171 | 176 |
| |
172 | 177 |
| |
173 | 178 |
| |
| |||
591 | 596 |
| |
592 | 597 |
| |
593 | 598 |
| |
594 |
| - | |
| 599 | + | |
| 600 | + | |
595 | 601 |
| |
596 | 602 |
| |
597 | 603 |
| |
| |||
685 | 691 |
| |
686 | 692 |
| |
687 | 693 |
| |
688 |
| - | |
| 694 | + | |
689 | 695 |
| |
690 | 696 |
| |
691 | 697 |
| |
| |||
1774 | 1780 |
| |
1775 | 1781 |
| |
1776 | 1782 |
| |
1777 |
| - | |
| 1783 | + | |
1778 | 1784 |
| |
1779 | 1785 |
| |
1780 | 1786 |
| |
| |||
1783 | 1789 |
| |
1784 | 1790 |
| |
1785 | 1791 |
| |
1786 |
| - | |
1787 |
| - | |
1788 |
| - | |
1789 |
| - | |
1790 |
| - | |
1791 |
| - | |
1792 |
| - | |
1793 |
| - | |
1794 |
| - | |
1795 |
| - | |
1796 |
| - | |
1797 |
| - | |
1798 |
| - | |
1799 |
| - | |
1800 |
| - | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
1801 | 1800 |
| |
1802 |
| - | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
1803 | 1820 |
| |
1804 | 1821 |
| |
1805 | 1822 |
| |
| |||
1808 | 1825 |
| |
1809 | 1826 |
| |
1810 | 1827 |
| |
1811 |
| - | |
| 1828 | + | |
1812 | 1829 |
| |
1813 |
| - | |
| 1830 | + | |
1814 | 1831 |
| |
1815 |
| - | |
1816 |
| - | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
1817 | 1855 |
| |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
1818 | 1859 |
| |
1819 | 1860 |
| |
1820 |
| - | |
| 1861 | + | |
| 1862 | + | |
1821 | 1863 |
| |
1822 | 1864 |
| |
1823 | 1865 |
| |
|
0 commit comments
Comments
(0)