1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

heap_fetch requires buffer pointer, must be released; heap_getnext

no longer returns buffer pointer, can be gotten from scan;
	descriptor; bootstrap can create multi-key indexes;
pg_procname index now is multi-key index; oidint2, oidint4, oidname
are gone (must be removed from regression tests); use System Cache
rather than sequential scan in many places; heap_modifytuple no
longer takes buffer parameter; remove unused buffer parameter in
a few other functions; oid8 is not index-able; remove some use of
single-character variable names; cleanup Buffer variables usage
and scan descriptor looping; cleaned up allocation and freeing of
tuples; 18k lines of diff;
This commit is contained in:
Bruce Momjian
1998-08-19 02:04:17 +00:00
parent 31de2c9461
commit 7971539020
123 changed files with 2139 additions and 3134 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.40 1998/08/01 15:26:12 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.41 1998/08/19 02:02:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -100,7 +100,7 @@ static void BufferSync(void);
static int BufferReplace(BufferDesc *bufHdr, bool bufferLockHeld);
/* not static but used by vacuum only ... */
int BlowawayRelationBuffers(Relation rdesc, BlockNumber block);
int BlowawayRelationBuffers(Relation rel, BlockNumber block);
/* ---------------------------------------------------
* RelationGetBufferWithBuffer
@ -135,7 +135,7 @@ RelationGetBufferWithBuffer(Relation relation,
else
{
bufHdr = &LocalBufferDescriptors[-buffer - 1];
if (bufHdr->tag.relId.relId == relation->rd_id &&
if (bufHdr->tag.relId.relId == RelationGetRelid(relation) &&
bufHdr->tag.blockNum == blockNumber)
return (buffer);
}
@ -416,7 +416,7 @@ BufferAlloc(Relation reln,
}
}
#ifdef BMTRACE
_bm_trace((reln->rd_rel->relisshared ? 0 : MyDatabaseId), reln->rd_id, blockNum, BufferDescriptorGetBuffer(buf), BMT_ALLOCFND);
_bm_trace((reln->rd_rel->relisshared ? 0 : MyDatabaseId), RelationGetRelid(reln), blockNum, BufferDescriptorGetBuffer(buf), BMT_ALLOCFND);
#endif /* BMTRACE */
SpinRelease(BufMgrLock);
@ -660,7 +660,7 @@ BufferAlloc(Relation reln,
}
#ifdef BMTRACE
_bm_trace((reln->rd_rel->relisshared ? 0 : MyDatabaseId), reln->rd_id, blockNum, BufferDescriptorGetBuffer(buf), BMT_ALLOCNOTFND);
_bm_trace((reln->rd_rel->relisshared ? 0 : MyDatabaseId), RelationGetRelid(reln), blockNum, BufferDescriptorGetBuffer(buf), BMT_ALLOCNOTFND);
#endif /* BMTRACE */
SpinRelease(BufMgrLock);
@ -1389,19 +1389,19 @@ RelationGetNumberOfBlocks(Relation relation)
* --------------------------------------------------------------------
*/
void
ReleaseRelationBuffers(Relation rdesc)
ReleaseRelationBuffers(Relation rel)
{
int i;
int holding = 0;
BufferDesc *buf;
if (rdesc->rd_islocal)
if (rel->rd_islocal)
{
for (i = 0; i < NLocBuffer; i++)
{
buf = &LocalBufferDescriptors[i];
if ((buf->flags & BM_DIRTY) &&
(buf->tag.relId.relId == rdesc->rd_id))
(buf->tag.relId.relId == RelationGetRelid(rel)))
buf->flags &= ~BM_DIRTY;
}
return;
@ -1417,7 +1417,7 @@ ReleaseRelationBuffers(Relation rdesc)
}
if ((buf->flags & BM_DIRTY) &&
(buf->tag.relId.dbId == MyDatabaseId) &&
(buf->tag.relId.relId == rdesc->rd_id))
(buf->tag.relId.relId == RelationGetRelid(rel)))
{
buf->flags &= ~BM_DIRTY;
if (!(buf->flags & BM_FREE))
@ -1559,29 +1559,29 @@ BufferPoolBlowaway()
* --------------------------------------------------------------------
*/
int
BlowawayRelationBuffers(Relation rdesc, BlockNumber block)
BlowawayRelationBuffers(Relation rel, BlockNumber block)
{
int i;
BufferDesc *buf;
if (rdesc->rd_islocal)
if (rel->rd_islocal)
{
for (i = 0; i < NLocBuffer; i++)
{
buf = &LocalBufferDescriptors[i];
if (buf->tag.relId.relId == rdesc->rd_id &&
if (buf->tag.relId.relId == RelationGetRelid(rel) &&
buf->tag.blockNum >= block)
{
if (buf->flags & BM_DIRTY)
{
elog(NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is dirty",
rdesc->rd_rel->relname.data, block, buf->tag.blockNum);
rel->rd_rel->relname.data, block, buf->tag.blockNum);
return (-1);
}
if (LocalRefCount[i] > 0)
{
elog(NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is referenced (%d)",
rdesc->rd_rel->relname.data, block,
rel->rd_rel->relname.data, block,
buf->tag.blockNum, LocalRefCount[i]);
return (-2);
}
@ -1596,7 +1596,7 @@ BlowawayRelationBuffers(Relation rdesc, BlockNumber block)
{
buf = &BufferDescriptors[i];
if (buf->tag.relId.dbId == MyDatabaseId &&
buf->tag.relId.relId == rdesc->rd_id &&
buf->tag.relId.relId == RelationGetRelid(rel) &&
buf->tag.blockNum >= block)
{
if (buf->flags & BM_DIRTY)