Skip to content

Commit de6a638

Browse files
committed
Update obsolete comment: it's no longer the case that mdread() will allow
reads beyond EOF, except by special coercion.
1 parent 011b51c commit de6a638

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.220 2007/05/30 20:11:58 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.221 2007/06/18 00:47:20 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -223,15 +223,14 @@ ReadBuffer_common(Relation reln, BlockNumber blockNum, bool zeroPage,
223223
* We get here only in the corner case where we are trying to extend
224224
* the relation but we found a pre-existing buffer marked BM_VALID.
225225
* This can happen because mdread doesn't complain about reads beyond
226-
* EOF --- which is arguably bogus, but changing it seems tricky ---
227-
* and so a previous attempt to read a block just beyond EOF could
228-
* have left a "valid" zero-filled buffer. Unfortunately, we have
229-
* also seen this case occurring because of buggy Linux kernels that
230-
* sometimes return an lseek(SEEK_END) result that doesn't account for
231-
* a recent write. In that situation, the pre-existing buffer would
232-
* contain valid data that we don't want to overwrite. Since the
233-
* legitimate cases should always have left a zero-filled buffer,
234-
* complain if not PageIsNew.
226+
* EOF (when zero_damaged_pages is ON) and so a previous attempt to
227+
* read a block beyond EOF could have left a "valid" zero-filled
228+
* buffer. Unfortunately, we have also seen this case occurring
229+
* because of buggy Linux kernels that sometimes return an
230+
* lseek(SEEK_END) result that doesn't account for a recent write.
231+
* In that situation, the pre-existing buffer would contain valid data
232+
* that we don't want to overwrite. Since the legitimate case should
233+
* always have left a zero-filled buffer, complain if not PageIsNew.
235234
*/
236235
bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr);
237236
if (!PageIsNew((PageHeader) bufBlock))

0 commit comments

Comments
 (0)