Skip to content

Commit 1b2bb33

Browse files
committed
Add a comment documenting the question of whether PrefetchBuffer should
try to protect an already-existing buffer from being evicted. This was left as an open issue when the posix_fadvise patch was committed. I'm not sure there's any evidence to justify more work in this area, but we should have some record about it in the source code.
1 parent cd331e4 commit 1b2bb33

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 13 additions & 1 deletion
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.250 2009/03/31 22:12:48 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.251 2009/04/03 18:17:43 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -153,6 +153,18 @@ PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum)
153153
/* If not in buffers, initiate prefetch */
154154
if (buf_id < 0)
155155
smgrprefetch(reln->rd_smgr, forkNum, blockNum);
156+
157+
/*
158+
* If the block *is* in buffers, we do nothing. This is not really
159+
* ideal: the block might be just about to be evicted, which would
160+
* be stupid since we know we are going to need it soon. But the
161+
* only easy answer is to bump the usage_count, which does not seem
162+
* like a great solution: when the caller does ultimately touch the
163+
* block, usage_count would get bumped again, resulting in too much
164+
* favoritism for blocks that are involved in a prefetch sequence.
165+
* A real fix would involve some additional per-buffer state, and
166+
* it's not clear that there's enough of a problem to justify that.
167+
*/
156168
}
157169
#endif /* USE_PREFETCH */
158170
}

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