mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
DropRelFileNodeBuffers failed to fix the state of the lookup hash table
that was added to localbuf.c in 8.1; therefore, applying it to a temp table left corrupt lookup state in memory. The only case where this had a significant chance of causing problems was an ON COMMIT DELETE ROWS temp table; the other possible paths left bogus state that was unlikely to be used again. Per report from Csaba Nagy.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.198 2005/10/27 17:07:58 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.199 2005/11/17 17:42:02 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1384,34 +1384,17 @@ DropRelFileNodeBuffers(RelFileNode rnode, bool istemp,
|
||||
BlockNumber firstDelBlock)
|
||||
{
|
||||
int i;
|
||||
volatile BufferDesc *bufHdr;
|
||||
|
||||
if (istemp)
|
||||
{
|
||||
for (i = 0; i < NLocBuffer; i++)
|
||||
{
|
||||
bufHdr = &LocalBufferDescriptors[i];
|
||||
if (RelFileNodeEquals(bufHdr->tag.rnode, rnode) &&
|
||||
bufHdr->tag.blockNum >= firstDelBlock)
|
||||
{
|
||||
if (LocalRefCount[i] != 0)
|
||||
elog(ERROR, "block %u of %u/%u/%u is still referenced (local %u)",
|
||||
bufHdr->tag.blockNum,
|
||||
bufHdr->tag.rnode.spcNode,
|
||||
bufHdr->tag.rnode.dbNode,
|
||||
bufHdr->tag.rnode.relNode,
|
||||
LocalRefCount[i]);
|
||||
CLEAR_BUFFERTAG(bufHdr->tag);
|
||||
bufHdr->flags = 0;
|
||||
bufHdr->usage_count = 0;
|
||||
}
|
||||
}
|
||||
DropRelFileNodeLocalBuffers(rnode, firstDelBlock);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < NBuffers; i++)
|
||||
{
|
||||
bufHdr = &BufferDescriptors[i];
|
||||
volatile BufferDesc *bufHdr = &BufferDescriptors[i];
|
||||
|
||||
LockBufHdr(bufHdr);
|
||||
if (RelFileNodeEquals(bufHdr->tag.rnode, rnode) &&
|
||||
bufHdr->tag.blockNum >= firstDelBlock)
|
||||
|
Reference in New Issue
Block a user