mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
Convert many uses of ReadBuffer[Extended](P_NEW) to ExtendBufferedRel()
A few places are not converted. Some because they are tackled in later commits (e.g. hio.c, xlogutils.c), some because they are more complicated (e.g. brin_pageops.c). Having a few users of ReadBuffer(P_NEW) is good anyway, to ensure the backward compat path stays working. Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de
This commit is contained in:
@@ -206,14 +206,14 @@ _hash_getnewbuf(Relation rel, BlockNumber blkno, ForkNumber forkNum)
|
||||
elog(ERROR, "access to noncontiguous page in hash index \"%s\"",
|
||||
RelationGetRelationName(rel));
|
||||
|
||||
/* smgr insists we use P_NEW to extend the relation */
|
||||
/* smgr insists we explicitly extend the relation */
|
||||
if (blkno == nblocks)
|
||||
{
|
||||
buf = ReadBufferExtended(rel, forkNum, P_NEW, RBM_NORMAL, NULL);
|
||||
buf = ExtendBufferedRel(EB_REL(rel), forkNum, NULL,
|
||||
EB_LOCK_FIRST | EB_SKIP_EXTENSION_LOCK);
|
||||
if (BufferGetBlockNumber(buf) != blkno)
|
||||
elog(ERROR, "unexpected hash relation size: %u, should be %u",
|
||||
BufferGetBlockNumber(buf), blkno);
|
||||
LockBuffer(buf, HASH_WRITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user