mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
FlushRelationBuffers was also being a bit cavalier about whether the
relation is already opened by smgr.
This commit is contained in:
parent
556110f4e0
commit
a421b4e850
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
int i;
|
||||||
BufferDesc *bufHdr;
|
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)
|
if (rel->rd_istemp)
|
||||||
{
|
{
|
||||||
for (i = 0; i < NLocBuffer; i++)
|
for (i = 0; i < NLocBuffer; i++)
|
||||||
@ -1384,10 +1388,6 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
|
|||||||
errcontext.previous = error_context_stack;
|
errcontext.previous = error_context_stack;
|
||||||
error_context_stack = &errcontext;
|
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,
|
smgrwrite(rel->rd_smgr,
|
||||||
bufHdr->tag.blockNum,
|
bufHdr->tag.blockNum,
|
||||||
(char *) MAKE_PTR(bufHdr->data),
|
(char *) MAKE_PTR(bufHdr->data),
|
||||||
|
Loading…
Reference in New Issue
Block a user