static pg_attribute_always_inline Buffer
PinBufferForBlock(Relation rel,
SMgrRelation smgr,
- char smgr_persistence,
+ char persistence,
ForkNumber forkNum,
BlockNumber blockNum,
BufferAccessStrategy strategy,
BufferDesc *bufHdr;
IOContext io_context;
IOObject io_object;
- char persistence;
Assert(blockNum != P_NEW);
- if (rel)
- persistence = rel->rd_rel->relpersistence;
- else
- persistence = smgr_persistence;
+ /* Persistence should be set before */
+ Assert((persistence == RELPERSISTENCE_TEMP ||
+ persistence == RELPERSISTENCE_PERMANENT ||
+ persistence == RELPERSISTENCE_UNLOGGED));
if (persistence == RELPERSISTENCE_TEMP)
{
ReadBuffersOperation operation;
Buffer buffer;
int flags;
+ char persistence;
/*
* Backward compatibility path, most code should use ExtendBufferedRel()
return ExtendBufferedRel(BMR_REL(rel), forkNum, strategy, flags);
}
+ if (rel)
+ persistence = rel->rd_rel->relpersistence;
+ else
+ persistence = smgr_persistence;
+
if (unlikely(mode == RBM_ZERO_AND_CLEANUP_LOCK ||
mode == RBM_ZERO_AND_LOCK))
{
bool found;
- buffer = PinBufferForBlock(rel, smgr, smgr_persistence,
+ buffer = PinBufferForBlock(rel, smgr, persistence,
forkNum, blockNum, strategy, &found);
ZeroAndLockBuffer(buffer, mode, found);
return buffer;
flags = 0;
operation.smgr = smgr;
operation.rel = rel;
- operation.smgr_persistence = smgr_persistence;
+ operation.persistence = persistence;
operation.forknum = forkNum;
operation.strategy = strategy;
if (StartReadBuffer(&operation,
buffers[i] = PinBufferForBlock(operation->rel,
operation->smgr,
- operation->smgr_persistence,
+ operation->persistence,
operation->forknum,
blockNum + i,
operation->strategy,
buffers = &operation->buffers[0];
blocknum = operation->blocknum;
forknum = operation->forknum;
+ persistence = operation->persistence;
- persistence = operation->rel
- ? operation->rel->rd_rel->relpersistence
- : RELPERSISTENCE_PERMANENT;
if (persistence == RELPERSISTENCE_TEMP)
{
io_context = IOCONTEXT_NORMAL;