Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7114791

Browse files
committed
ExtendBufferedWhat -> BufferManagerRelation.
Commit 31966b1 invented a way for functions dealing with relation extension to accept a Relation in online code and an SMgrRelation in recovery code. It seems highly likely that future bufmgr.c interfaces will face the same problem, and need to do something similar. Generalize the names so that each interface doesn't have to re-invent the wheel. Back-patch to 16. Since extension AM authors might start using the constructor macros once 16 ships, we agreed to do the rename in 16 rather than waiting for 17. Reviewed-by: Peter Geoghegan <pg@bowt.ie> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CA%2BhUKG%2B6tLD2BhpRWycEoti6LVLyQq457UL4ticP5xd8LqHySA%40mail.gmail.com
1 parent 37188ce commit 7114791

File tree

20 files changed

+90
-90
lines changed

20 files changed

+90
-90
lines changed

contrib/bloom/blutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ BloomNewBuffer(Relation index)
386386
}
387387

388388
/* Must extend the file */
389-
buffer = ExtendBufferedRel(EB_REL(index), MAIN_FORKNUM, NULL,
389+
buffer = ExtendBufferedRel(BMR_REL(index), MAIN_FORKNUM, NULL,
390390
EB_LOCK_FIRST);
391391

392392
return buffer;

src/backend/access/brin/brin.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ brinbuild(Relation heap, Relation index, IndexInfo *indexInfo)
848848
* whole relation will be rolled back.
849849
*/
850850

851-
meta = ExtendBufferedRel(EB_REL(index), MAIN_FORKNUM, NULL,
851+
meta = ExtendBufferedRel(BMR_REL(index), MAIN_FORKNUM, NULL,
852852
EB_LOCK_FIRST | EB_SKIP_EXTENSION_LOCK);
853853
Assert(BufferGetBlockNumber(meta) == BRIN_METAPAGE_BLKNO);
854854

@@ -915,7 +915,7 @@ brinbuildempty(Relation index)
915915
Buffer metabuf;
916916

917917
/* An empty BRIN index has a metapage only. */
918-
metabuf = ExtendBufferedRel(EB_REL(index), INIT_FORKNUM, NULL,
918+
metabuf = ExtendBufferedRel(BMR_REL(index), INIT_FORKNUM, NULL,
919919
EB_LOCK_FIRST | EB_SKIP_EXTENSION_LOCK);
920920

921921
/* Initialize and xlog metabuffer. */

src/backend/access/brin/brin_revmap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ revmap_physical_extend(BrinRevmap *revmap)
569569
}
570570
else
571571
{
572-
buf = ExtendBufferedRel(EB_REL(irel), MAIN_FORKNUM, NULL,
572+
buf = ExtendBufferedRel(BMR_REL(irel), MAIN_FORKNUM, NULL,
573573
EB_LOCK_FIRST);
574574
if (BufferGetBlockNumber(buf) != mapBlk)
575575
{

src/backend/access/gin/gininsert.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ ginbuildempty(Relation index)
440440
MetaBuffer;
441441

442442
/* An empty GIN index has two pages. */
443-
MetaBuffer = ExtendBufferedRel(EB_REL(index), INIT_FORKNUM, NULL,
443+
MetaBuffer = ExtendBufferedRel(BMR_REL(index), INIT_FORKNUM, NULL,
444444
EB_LOCK_FIRST | EB_SKIP_EXTENSION_LOCK);
445-
RootBuffer = ExtendBufferedRel(EB_REL(index), INIT_FORKNUM, NULL,
445+
RootBuffer = ExtendBufferedRel(BMR_REL(index), INIT_FORKNUM, NULL,
446446
EB_LOCK_FIRST | EB_SKIP_EXTENSION_LOCK);
447447

448448
/* Initialize and xlog metabuffer and root buffer. */

src/backend/access/gin/ginutil.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ GinNewBuffer(Relation index)
327327
}
328328

329329
/* Must extend the file */
330-
buffer = ExtendBufferedRel(EB_REL(index), MAIN_FORKNUM, NULL,
330+
buffer = ExtendBufferedRel(BMR_REL(index), MAIN_FORKNUM, NULL,
331331
EB_LOCK_FIRST);
332332

333333
return buffer;

src/backend/access/gist/gist.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ gistbuildempty(Relation index)
134134
Buffer buffer;
135135

136136
/* Initialize the root page */
137-
buffer = ExtendBufferedRel(EB_REL(index), INIT_FORKNUM, NULL,
137+
buffer = ExtendBufferedRel(BMR_REL(index), INIT_FORKNUM, NULL,
138138
EB_SKIP_EXTENSION_LOCK | EB_LOCK_FIRST);
139139

140140
/* Initialize and xlog buffer */

src/backend/access/gist/gistutil.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ gistNewBuffer(Relation r, Relation heaprel)
877877
}
878878

879879
/* Must extend the file */
880-
buffer = ExtendBufferedRel(EB_REL(r), MAIN_FORKNUM, NULL,
880+
buffer = ExtendBufferedRel(BMR_REL(r), MAIN_FORKNUM, NULL,
881881
EB_LOCK_FIRST);
882882

883883
return buffer;

src/backend/access/hash/hashpage.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ _hash_getnewbuf(Relation rel, BlockNumber blkno, ForkNumber forkNum)
209209
/* smgr insists we explicitly extend the relation */
210210
if (blkno == nblocks)
211211
{
212-
buf = ExtendBufferedRel(EB_REL(rel), forkNum, NULL,
212+
buf = ExtendBufferedRel(BMR_REL(rel), forkNum, NULL,
213213
EB_LOCK_FIRST | EB_SKIP_EXTENSION_LOCK);
214214
if (BufferGetBlockNumber(buf) != blkno)
215215
elog(ERROR, "unexpected hash relation size: %u, should be %u",

src/backend/access/heap/hio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ RelationAddBlocks(Relation relation, BulkInsertState bistate,
339339
* [auto]vacuum trying to truncate later pages as REL_TRUNCATE_MINIMUM is
340340
* way larger.
341341
*/
342-
first_block = ExtendBufferedRelBy(EB_REL(relation), MAIN_FORKNUM,
342+
first_block = ExtendBufferedRelBy(BMR_REL(relation), MAIN_FORKNUM,
343343
bistate ? bistate->strategy : NULL,
344344
EB_LOCK_FIRST,
345345
extend_by_pages,

src/backend/access/heap/visibilitymap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ vm_extend(Relation rel, BlockNumber vm_nblocks)
628628
{
629629
Buffer buf;
630630

631-
buf = ExtendBufferedRelTo(EB_REL(rel), VISIBILITYMAP_FORKNUM, NULL,
631+
buf = ExtendBufferedRelTo(BMR_REL(rel), VISIBILITYMAP_FORKNUM, NULL,
632632
EB_CREATE_FORK_IF_NEEDED |
633633
EB_CLEAR_SIZE_CACHE,
634634
vm_nblocks,

src/backend/access/nbtree/nbtpage.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ _bt_allocbuf(Relation rel, Relation heaprel)
975975
* otherwise would make, as we can't use _bt_lockbuf() without introducing
976976
* a race.
977977
*/
978-
buf = ExtendBufferedRel(EB_REL(rel), MAIN_FORKNUM, NULL, EB_LOCK_FIRST);
978+
buf = ExtendBufferedRel(BMR_REL(rel), MAIN_FORKNUM, NULL, EB_LOCK_FIRST);
979979
if (!RelationUsesLocalBuffers(rel))
980980
VALGRIND_MAKE_MEM_DEFINED(BufferGetPage(buf), BLCKSZ);
981981

src/backend/access/spgist/spgutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ SpGistNewBuffer(Relation index)
405405
ReleaseBuffer(buffer);
406406
}
407407

408-
buffer = ExtendBufferedRel(EB_REL(index), MAIN_FORKNUM, NULL,
408+
buffer = ExtendBufferedRel(BMR_REL(index), MAIN_FORKNUM, NULL,
409409
EB_LOCK_FIRST);
410410

411411
return buffer;

src/backend/access/transam/xlogutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ XLogReadBufferExtended(RelFileLocator rlocator, ForkNumber forknum,
524524
/* OK to extend the file */
525525
/* we do this in recovery only - no rel-extension lock needed */
526526
Assert(InRecovery);
527-
buffer = ExtendBufferedRelTo(EB_SMGR(smgr, RELPERSISTENCE_PERMANENT),
527+
buffer = ExtendBufferedRelTo(BMR_SMGR(smgr, RELPERSISTENCE_PERMANENT),
528528
forknum,
529529
NULL,
530530
EB_PERFORMING_RECOVERY |

src/backend/commands/sequence.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ fill_seq_fork_with_data(Relation rel, HeapTuple tuple, ForkNumber forkNum)
377377

378378
/* Initialize first page of relation with special magic number */
379379

380-
buf = ExtendBufferedRel(EB_REL(rel), forkNum, NULL,
380+
buf = ExtendBufferedRel(BMR_REL(rel), forkNum, NULL,
381381
EB_LOCK_FIRST | EB_SKIP_EXTENSION_LOCK);
382382
Assert(BufferGetBlockNumber(buf) == 0);
383383

0 commit comments

Comments
 (0)