Skip to content

Commit e00c45f

Browse files
committed
Remove "smgr_persistence == 0" dead code.
Reaching that code would have required multiple processes performing relation extension during recovery, which does not happen. That caller has the persistence available, so pass it. This was dead code as soon as commit 210622c added it. Discussion: https://postgr.es/m/CAN55FZ0JKL6vk1xQp6rfOXiNFV1u1H0tJDPPGHWoiO3ea2Wc=A@mail.gmail.com
1 parent 22b0ccd commit e00c45f

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ ExtendBufferedRelTo(BufferManagerRelation bmr,
10021002
if (buffer == InvalidBuffer)
10031003
{
10041004
Assert(extended_by == 0);
1005-
buffer = ReadBuffer_common(bmr.rel, bmr.smgr, 0,
1005+
buffer = ReadBuffer_common(bmr.rel, bmr.smgr, bmr.relpersistence,
10061006
fork, extend_to - 1, mode, strategy);
10071007
}
10081008

@@ -1117,16 +1117,8 @@ PinBufferForBlock(Relation rel,
11171117

11181118
Assert(blockNum != P_NEW);
11191119

1120-
/*
1121-
* If there is no Relation it usually implies recovery and thus permanent,
1122-
* but we take an argument because CreateAndCopyRelationData can reach us
1123-
* with only an SMgrRelation for an unlogged relation that we don't want
1124-
* to flag with BM_PERMANENT.
1125-
*/
11261120
if (rel)
11271121
persistence = rel->rd_rel->relpersistence;
1128-
else if (smgr_persistence == 0)
1129-
persistence = RELPERSISTENCE_PERMANENT;
11301122
else
11311123
persistence = smgr_persistence;
11321124

src/include/storage/bufmgr.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,10 @@ typedef struct BufferManagerRelation
114114

115115
struct ReadBuffersOperation
116116
{
117-
/*
118-
* The following members should be set by the caller. If only smgr is
119-
* provided without rel, then smgr_persistence can be set to override the
120-
* default assumption of RELPERSISTENCE_PERMANENT.
121-
*/
122-
Relation rel;
117+
/* The following members should be set by the caller. */
118+
Relation rel; /* optional */
123119
struct SMgrRelationData *smgr;
124-
char smgr_persistence;
120+
char smgr_persistence; /* optional if rel != NULL */
125121
ForkNumber forknum;
126122
BufferAccessStrategy strategy;
127123

0 commit comments

Comments
 (0)