FlushRelationBuffers was also being a bit cavalier about whether the

relation is already opened by smgr.
This commit is contained in:
Tom Lane 2004-08-31 16:13:06 +00:00
parent 556110f4e0
commit a421b4e850

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.175 2004/08/29 05:06:47 momjian Exp $
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.176 2004/08/31 16:13:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1366,6 +1366,10 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
int i;
BufferDesc *bufHdr;
/* Open rel at the smgr level if not already done */
if (rel->rd_smgr == NULL)
rel->rd_smgr = smgropen(rel->rd_node);
if (rel->rd_istemp)
{
for (i = 0; i < NLocBuffer; i++)
@ -1384,10 +1388,6 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
errcontext.previous = error_context_stack;
error_context_stack = &errcontext;
/* Open rel at the smgr level if not already done */
if (rel->rd_smgr == NULL)
rel->rd_smgr = smgropen(rel->rd_node);
smgrwrite(rel->rd_smgr,
bufHdr->tag.blockNum,
(char *) MAKE_PTR(bufHdr->data),