@@ -1710,12 +1710,13 @@ GetXLogBuffer(XLogRecPtr ptr, TimeLineID tli)
1710
1710
* of bytes read successfully.
1711
1711
*
1712
1712
* Fewer than 'count' bytes may be read if some of the requested WAL data has
1713
- * already been evicted from the WAL buffers, or if the caller requests data
1714
- * that is not yet available.
1713
+ * already been evicted.
1715
1714
*
1716
1715
* No locks are taken.
1717
1716
*
1718
- * The 'tli' argument is only used as a convenient safety check so that
1717
+ * Caller should ensure that it reads no further than LogwrtResult.Write
1718
+ * (which should have been updated by the caller when determining how far to
1719
+ * read). The 'tli' argument is only used as a convenient safety check so that
1719
1720
* callers do not read from WAL buffers on a historical timeline.
1720
1721
*/
1721
1722
Size
@@ -1724,26 +1725,13 @@ WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count,
1724
1725
{
1725
1726
char * pdst = dstbuf ;
1726
1727
XLogRecPtr recptr = startptr ;
1727
- XLogRecPtr upto ;
1728
- Size nbytes ;
1728
+ Size nbytes = count ;
1729
1729
1730
1730
if (RecoveryInProgress () || tli != GetWALInsertionTimeLine ())
1731
1731
return 0 ;
1732
1732
1733
1733
Assert (!XLogRecPtrIsInvalid (startptr ));
1734
-
1735
- /*
1736
- * Don't read past the available WAL data.
1737
- *
1738
- * Check using local copy of LogwrtResult. Ordinarily it's been updated by
1739
- * the caller when determining how far to read; but if not, it just means
1740
- * we'll read less data.
1741
- *
1742
- * XXX: the available WAL could be extended to the WAL insert pointer by
1743
- * calling WaitXLogInsertionsToFinish().
1744
- */
1745
- upto = Min (startptr + count , LogwrtResult .Write );
1746
- nbytes = upto - startptr ;
1734
+ Assert (startptr + count <= LogwrtResult .Write );
1747
1735
1748
1736
/*
1749
1737
* Loop through the buffers without a lock. For each buffer, atomically
0 commit comments