1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-24 10:47:04 +03:00

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 210622c60e1a9db2e2730140b8106ab57d259d15 added it.

Discussion: https://postgr.es/m/CAN55FZ0JKL6vk1xQp6rfOXiNFV1u1H0tJDPPGHWoiO3ea2Wc=A@mail.gmail.com
This commit is contained in:
Noah Misch 2024-07-20 04:22:12 -07:00
parent 22b0ccd65d
commit e00c45f685
2 changed files with 4 additions and 16 deletions

View File

@ -1002,7 +1002,7 @@ ExtendBufferedRelTo(BufferManagerRelation bmr,
if (buffer == InvalidBuffer) if (buffer == InvalidBuffer)
{ {
Assert(extended_by == 0); Assert(extended_by == 0);
buffer = ReadBuffer_common(bmr.rel, bmr.smgr, 0, buffer = ReadBuffer_common(bmr.rel, bmr.smgr, bmr.relpersistence,
fork, extend_to - 1, mode, strategy); fork, extend_to - 1, mode, strategy);
} }
@ -1117,16 +1117,8 @@ PinBufferForBlock(Relation rel,
Assert(blockNum != P_NEW); Assert(blockNum != P_NEW);
/*
* If there is no Relation it usually implies recovery and thus permanent,
* but we take an argument because CreateAndCopyRelationData can reach us
* with only an SMgrRelation for an unlogged relation that we don't want
* to flag with BM_PERMANENT.
*/
if (rel) if (rel)
persistence = rel->rd_rel->relpersistence; persistence = rel->rd_rel->relpersistence;
else if (smgr_persistence == 0)
persistence = RELPERSISTENCE_PERMANENT;
else else
persistence = smgr_persistence; persistence = smgr_persistence;

View File

@ -114,14 +114,10 @@ typedef struct BufferManagerRelation
struct ReadBuffersOperation struct ReadBuffersOperation
{ {
/* /* The following members should be set by the caller. */
* The following members should be set by the caller. If only smgr is Relation rel; /* optional */
* provided without rel, then smgr_persistence can be set to override the
* default assumption of RELPERSISTENCE_PERMANENT.
*/
Relation rel;
struct SMgrRelationData *smgr; struct SMgrRelationData *smgr;
char smgr_persistence; char smgr_persistence; /* optional if rel != NULL */
ForkNumber forknum; ForkNumber forknum;
BufferAccessStrategy strategy; BufferAccessStrategy strategy;