Skip to content

Commit 63735ca

Browse files
committed
Dept. of second thoughts: add comments cautioning against using
ReadOrZeroBuffer to fetch pages from beyond physical EOF. This would usually work, but would cause problems for md.c if writes occurred beyond a segment boundary when the previous segment file hadn't been fully extended.
1 parent 8c3cc86 commit 63735ca

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 7 additions & 2 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.217 2007/05/02 23:18:03 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.218 2007/05/02 23:34:48 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -21,7 +21,9 @@
2121
* cache we don't read it, but just return a zeroed-out buffer. Useful
2222
* when the caller intends to fill the page from scratch, since this
2323
* saves I/O and avoids unnecessary failure if the page-on-disk has
24-
* corrupt page headers.
24+
* corrupt page headers. Caution: do not use this to read a page that
25+
* is beyond the relation's current physical EOF; that is likely to
26+
* cause problems in md.c when the page is modified and written out.
2527
*
2628
* ReleaseBuffer() -- unpin a buffer
2729
*
@@ -137,6 +139,9 @@ ReadBuffer(Relation reln, BlockNumber blockNum)
137139
* cache already, it's filled with zeros instead of reading it from
138140
* disk. The caller is expected to overwrite the whole buffer,
139141
* so that the current page contents are not interesting.
142+
* Caution: do not use this to read a page that is beyond the relation's
143+
* current physical EOF; that is likely to cause problems in md.c when
144+
* the page is modified and written out. P_NEW is OK, though.
140145
*/
141146
Buffer
142147
ReadOrZeroBuffer(Relation reln, BlockNumber blockNum)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy