Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit63735ca

Browse files
committed
Dept. of second thoughts: add comments cautioning against using
ReadOrZeroBuffer to fetch pages from beyond physical EOF. This wouldusually work, but would cause problems for md.c if writes occurredbeyond a segment boundary when the previous segment file hadn't beenfully extended.
1 parent8c3cc86 commit63735ca

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(Relationreln,BlockNumberblockNum)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp