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

Commit3d6a984

Browse files
committed
Don't initialize page in {vm,fsm}_extend(), not needed
The read path needs to be able to initialize pages anyway, as relationextensions are not durable. By avoiding initializing pages, we can, in afuture patch, extend the relation by multiple blocks at once.Using smgrextend() for {vm,fsm}_extend() is not a good idea in general, as atleast one page of the VM/FSM will be read immediately after, always causing acache miss, requiring us to read content we just wrote.Discussion:https://postgr.es/m/20230301223515.pucbj7nb54n4i4nv@awork3.anarazel.de
1 parent86a3fc7 commit3d6a984

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

‎src/backend/access/heap/visibilitymap.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,9 @@ static void
622622
vm_extend(Relationrel,BlockNumbervm_nblocks)
623623
{
624624
BlockNumbervm_nblocks_now;
625-
PGAlignedBlockpg;
625+
PGAlignedBlockpg= {0};
626626
SMgrRelationreln;
627627

628-
PageInit((Page)pg.data,BLCKSZ,0);
629-
630628
/*
631629
* We use the relation extension lock to lock out other backends trying to
632630
* extend the visibility map at the same time. It also locks out extension
@@ -662,8 +660,6 @@ vm_extend(Relation rel, BlockNumber vm_nblocks)
662660
/* Now extend the file */
663661
while (vm_nblocks_now<vm_nblocks)
664662
{
665-
PageSetChecksumInplace((Page)pg.data,vm_nblocks_now);
666-
667663
smgrextend(reln,VISIBILITYMAP_FORKNUM,vm_nblocks_now,pg.data, false);
668664
vm_nblocks_now++;
669665
}

‎src/backend/storage/freespace/freespace.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,9 @@ static void
608608
fsm_extend(Relationrel,BlockNumberfsm_nblocks)
609609
{
610610
BlockNumberfsm_nblocks_now;
611-
PGAlignedBlockpg;
611+
PGAlignedBlockpg= {0};
612612
SMgrRelationreln;
613613

614-
PageInit((Page)pg.data,BLCKSZ,0);
615614

616615
/*
617616
* We use the relation extension lock to lock out other backends trying to
@@ -649,8 +648,6 @@ fsm_extend(Relation rel, BlockNumber fsm_nblocks)
649648
/* Extend as needed. */
650649
while (fsm_nblocks_now<fsm_nblocks)
651650
{
652-
PageSetChecksumInplace((Page)pg.data,fsm_nblocks_now);
653-
654651
smgrextend(reln,FSM_FORKNUM,fsm_nblocks_now,
655652
pg.data, false);
656653
fsm_nblocks_now++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp