diff options
| author | Bruce Momjian <bruce@momjian.us> | 1998-08-19 02:04:17 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 1998-08-19 02:04:17 +0000 |
| commit | 7971539020a344dce3a8b3b9b93ff4f10e2f823a (patch) | |
| tree | 8dca0af0d3ac8d431bff8c0dec793fe9733a1ee9 /src/backend/storage | |
| parent | 31de2c9461dff3284ad61084c73eba093fa3f68e (diff) | |
| download | postgresql-7971539020a344dce3a8b3b9b93ff4f10e2f823a.tar.gz | |
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;
Diffstat (limited to 'src/backend/storage')
| -rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 30 | ||||
| -rw-r--r-- | src/backend/storage/buffer/localbuf.c | 10 | ||||
| -rw-r--r-- | src/backend/storage/large_object/inv_api.c | 123 | ||||
| -rw-r--r-- | src/backend/storage/lmgr/lmgr.c | 6 | ||||
| -rw-r--r-- | src/backend/storage/lmgr/multi.c | 4 | ||||
| -rw-r--r-- | src/backend/storage/smgr/mm.c | 18 |
6 files changed, 95 insertions, 96 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index cffe640e2c..77efdf3538 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -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) diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 3d05dc4b85..e08450da85 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.18 1998/02/26 04:35:26 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.19 1998/08/19 02:02:37 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -76,13 +76,13 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr) /* a low tech search for now -- not optimized for scans */ for (i = 0; i < NLocBuffer; i++) { - if (LocalBufferDescriptors[i].tag.relId.relId == reln->rd_id && + if (LocalBufferDescriptors[i].tag.relId.relId == RelationGetRelid(reln) && LocalBufferDescriptors[i].tag.blockNum == blockNum) { #ifdef LBDEBUG fprintf(stderr, "LB ALLOC (%d,%d) %d\n", - reln->rd_id, blockNum, -i - 1); + RelationGetRelid(reln), blockNum, -i - 1); #endif LocalRefCount[i]++; *foundPtr = TRUE; @@ -92,7 +92,7 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr) #ifdef LBDEBUG fprintf(stderr, "LB ALLOC (%d,%d) %d\n", - reln->rd_id, blockNum, -nextFreeLocalBuf - 1); + RelationGetRelid(reln), blockNum, -nextFreeLocalBuf - 1); #endif /* need to get a new buffer (round robin for now) */ @@ -132,7 +132,7 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr) /* * it's all ours now. */ - bufHdr->tag.relId.relId = reln->rd_id; + bufHdr->tag.relId.relId = RelationGetRelid(reln); bufHdr->tag.blockNum = blockNum; bufHdr->flags &= ~BM_DIRTY; diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c index f06bb5968a..28856f5184 100644 --- a/src/backend/storage/large_object/inv_api.c +++ b/src/backend/storage/large_object/inv_api.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.33 1998/08/06 05:12:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.34 1998/08/19 02:02:38 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -81,12 +81,12 @@ static HeapTuple inv_newtuple(LargeObjectDesc *obj_desc, Buffer buffer, Page page, char *dbuf, int nwrite); -static HeapTuple inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP); +static HeapTuple inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *buffer); static int inv_wrnew(LargeObjectDesc *obj_desc, char *buf, int nbytes); static int inv_wrold(LargeObjectDesc *obj_desc, char *dbuf, int nbytes, - HeapTuple htup, Buffer buffer); -static void inv_indextup(LargeObjectDesc *obj_desc, HeapTuple htup); + HeapTuple tuple, Buffer buffer); +static void inv_indextup(LargeObjectDesc *obj_desc, HeapTuple tuple); static int _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln); /* @@ -122,14 +122,16 @@ inv_create(int flags) sprintf(objname, "xinv%d", file_oid); sprintf(indname, "xinx%d", file_oid); - if (SearchSysCacheTuple(RELNAME, PointerGetDatum(objname), + if (SearchSysCacheTuple(RELNAME, + PointerGetDatum(objname), 0, 0, 0) != NULL) { elog(ERROR, "internal error: %s already exists -- cannot create large obj", objname); } - if (SearchSysCacheTuple(RELNAME, PointerGetDatum(indname), + if (SearchSysCacheTuple(RELNAME, + PointerGetDatum(indname), 0, 0, 0) != NULL) { elog(ERROR, @@ -331,7 +333,7 @@ inv_stat(LargeObjectDesc *obj_desc, struct pgstat * stbuf) obj_desc->flags |= IFS_RDLOCK; } - stbuf->st_ino = obj_desc->heap_r->rd_id; + stbuf->st_ino = RelationGetRelid(obj_desc->heap_r); #if 1 stbuf->st_mode = (S_IFREG | 0666); /* IFREG|rw-rw-rw- */ #else @@ -439,8 +441,7 @@ inv_tell(LargeObjectDesc *obj_desc) int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes) { - HeapTuple htup; - Buffer b; + HeapTuple tuple; int nread; int off; int ncopy; @@ -467,18 +468,21 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes) /* fetch a block at a time */ while (nread < nbytes) { - + Buffer buffer; + /* fetch an inversion file system block */ - htup = inv_fetchtup(obj_desc, &b); + tuple = inv_fetchtup(obj_desc, &buffer); - if (!HeapTupleIsValid(htup)) + if (!HeapTupleIsValid(tuple)) { obj_desc->flags |= IFS_ATEOF; break; } /* copy the data from this block into the buffer */ - d = heap_getattr(htup, 2, obj_desc->hdesc, &isNull); + d = heap_getattr(tuple, 2, obj_desc->hdesc, &isNull); + ReleaseBuffer(buffer); + fsblock = (struct varlena *) DatumGetPointer(d); off = obj_desc->offset - obj_desc->lowbyte; @@ -487,9 +491,6 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes) ncopy = (nbytes - nread); memmove(buf, &(fsblock->vl_dat[off]), ncopy); - /* be a good citizen */ - ReleaseBuffer(b); - /* move pointers past the amount we just read */ buf += ncopy; nread += ncopy; @@ -503,8 +504,7 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes) int inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes) { - HeapTuple htup; - Buffer b; + HeapTuple tuple; int nwritten; int tuplen; @@ -527,7 +527,8 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes) /* write a block at a time */ while (nwritten < nbytes) { - + Buffer buffer; + /* * Fetch the current inversion file system block. If the class * storing the inversion file is empty, we don't want to do an @@ -537,21 +538,22 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes) if ((obj_desc->flags & IFS_ATEOF) || obj_desc->heap_r->rd_nblocks == 0) - htup = (HeapTuple) NULL; + tuple = (HeapTuple) NULL; else - htup = inv_fetchtup(obj_desc, &b); + tuple = inv_fetchtup(obj_desc, &buffer); /* either append or replace a block, as required */ - if (!HeapTupleIsValid(htup)) + if (!HeapTupleIsValid(tuple)) tuplen = inv_wrnew(obj_desc, buf, nbytes - nwritten); else { if (obj_desc->offset > obj_desc->highbyte) tuplen = inv_wrnew(obj_desc, buf, nbytes - nwritten); else - tuplen = inv_wrold(obj_desc, buf, nbytes - nwritten, htup, b); + tuplen = inv_wrold(obj_desc, buf, nbytes - nwritten, tuple, buffer); } - + ReleaseBuffer(buffer); + /* move pointers past the amount we just wrote */ buf += tuplen; nwritten += tuplen; @@ -602,9 +604,9 @@ inv_cleanindex(LargeObjectDesc *obj_desc) * such tuple exists. */ static HeapTuple -inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP) +inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *buffer) { - HeapTuple htup; + HeapTuple tuple; RetrieveIndexResult res; Datum d; int firstbyte, @@ -642,8 +644,11 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP) &skey); } + res = NULL; do { + if (res) + pfree(res); res = index_getnext(obj_desc->iscan, ForwardScanDirection); if (res == (RetrieveIndexResult) NULL) @@ -662,10 +667,9 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP) * */ - htup = heap_fetch(obj_desc->heap_r, SnapshotNow, - &(res->heap_iptr), bufP); - - } while (htup == (HeapTuple) NULL); + tuple = heap_fetch(obj_desc->heap_r, SnapshotNow, + &(res->heap_iptr), buffer); + } while (tuple == (HeapTuple) NULL); /* remember this tid -- we may need it for later reads/writes */ ItemPointerCopy(&(res->heap_iptr), &(obj_desc->htid)); @@ -673,8 +677,8 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP) } else { - htup = heap_fetch(obj_desc->heap_r, SnapshotNow, - &(obj_desc->htid), bufP); + tuple = heap_fetch(obj_desc->heap_r, SnapshotNow, + &(obj_desc->htid), buffer); } /* @@ -683,9 +687,9 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP) * return the tuple. */ - d = heap_getattr(htup, 1, obj_desc->hdesc, &isNull); + d = heap_getattr(tuple, 1, obj_desc->hdesc, &isNull); lastbyte = (int32) DatumGetInt32(d); - d = heap_getattr(htup, 2, obj_desc->hdesc, &isNull); + d = heap_getattr(tuple, 2, obj_desc->hdesc, &isNull); fsblock = (struct varlena *) DatumGetPointer(d); /* @@ -697,8 +701,7 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP) obj_desc->lowbyte = firstbyte; obj_desc->highbyte = lastbyte; - /* done */ - return (htup); + return tuple; } /* @@ -798,7 +801,7 @@ static int inv_wrold(LargeObjectDesc *obj_desc, char *dbuf, int nbytes, - HeapTuple htup, + HeapTuple tuple, Buffer buffer) { Relation hr; @@ -814,6 +817,7 @@ inv_wrold(LargeObjectDesc *obj_desc, freespc; bool isNull; int keep_offset; + RetrieveIndexResult res; /* * Since we're using a no-overwrite storage manager, the way we @@ -822,9 +826,9 @@ inv_wrold(LargeObjectDesc *obj_desc, * abstraction. */ - TransactionIdStore(GetCurrentTransactionId(), &(htup->t_xmax)); - htup->t_cmax = GetCurrentCommandId(); - htup->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID); + TransactionIdStore(GetCurrentTransactionId(), &(tuple->t_xmax)); + tuple->t_cmax = GetCurrentCommandId(); + tuple->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID); /* * If we're overwriting the entire block, we're lucky. All we need to @@ -851,7 +855,7 @@ inv_wrold(LargeObjectDesc *obj_desc, newpage = BufferGetPage(newbuf); hr = obj_desc->heap_r; freespc = IFREESPC(page); - d = heap_getattr(htup, 2, obj_desc->hdesc, &isNull); + d = heap_getattr(tuple, 2, obj_desc->hdesc, &isNull); fsblock = (struct varlena *) DatumGetPointer(d); tupbytes = fsblock->vl_len - sizeof(fsblock->vl_len); @@ -956,8 +960,12 @@ inv_wrold(LargeObjectDesc *obj_desc, * move the scandesc forward so we don't reread the newly inserted * tuple on the next index scan */ + res = NULL; if (obj_desc->iscan) - index_getnext(obj_desc->iscan, ForwardScanDirection); + res = index_getnext(obj_desc->iscan, ForwardScanDirection); + + if (res) + pfree(res); /* * Okay, by here, a tuple for the new block is correctly placed, @@ -1038,7 +1046,7 @@ inv_newtuple(LargeObjectDesc *obj_desc, */ ntup->t_len = tupsize; - ItemPointerSet(&(ntup->t_ctid), BufferGetBlockNumber(buffer), off); + ItemPointerSet(&ntup->t_ctid, BufferGetBlockNumber(buffer), off); LastOidProcessed = ntup->t_oid = newoid(); TransactionIdStore(GetCurrentTransactionId(), &(ntup->t_xmin)); ntup->t_cmin = GetCurrentCommandId(); @@ -1091,7 +1099,7 @@ inv_newtuple(LargeObjectDesc *obj_desc, } static void -inv_indextup(LargeObjectDesc *obj_desc, HeapTuple htup) +inv_indextup(LargeObjectDesc *obj_desc, HeapTuple tuple) { InsertIndexResult res; Datum v[1]; @@ -1100,7 +1108,7 @@ inv_indextup(LargeObjectDesc *obj_desc, HeapTuple htup) n[0] = ' '; v[0] = Int32GetDatum(obj_desc->highbyte); res = index_insert(obj_desc->index_r, &v[0], &n[0], - &(htup->t_ctid), obj_desc->heap_r); + &(tuple->t_ctid), obj_desc->heap_r); if (res) pfree(res); @@ -1203,17 +1211,15 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln) { IndexScanDesc iscan; RetrieveIndexResult res; - Buffer buf; - HeapTuple htup; + HeapTuple tuple; Datum d; long size; bool isNull; - + Buffer buffer; + /* scan backwards from end */ iscan = index_beginscan(ireln, (bool) 1, 0, (ScanKey) NULL); - buf = InvalidBuffer; - do { res = index_getnext(iscan, BackwardScanDirection); @@ -1235,25 +1241,18 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln) * rather that NowTimeQual. We currently have no way to pass a * time qual in. */ - - if (buf != InvalidBuffer) - ReleaseBuffer(buf); - - htup = heap_fetch(hreln, SnapshotNow, &(res->heap_iptr), &buf); + tuple = heap_fetch(hreln, SnapshotNow, &res->heap_iptr, &buffer); pfree(res); - - } while (!HeapTupleIsValid(htup)); + } while (!HeapTupleIsValid(tuple)); /* don't need the index scan anymore */ index_endscan(iscan); pfree(iscan); /* get olastbyte attribute */ - d = heap_getattr(htup, 1, hdesc, &isNull); + d = heap_getattr(tuple, 1, hdesc, &isNull); size = DatumGetInt32(d) + 1; - - /* wei hates it if you forget to do this */ - ReleaseBuffer(buf); - + ReleaseBuffer(buffer); + return (size); } diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c index cebbce364c..bcdc57d54f 100644 --- a/src/backend/storage/lmgr/lmgr.c +++ b/src/backend/storage/lmgr/lmgr.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.16 1998/08/01 15:26:24 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.17 1998/08/19 02:02:40 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,7 +67,7 @@ RelationInitLockInfo(Relation relation) extern GlobalMemory CacheCxt; Assert(RelationIsValid(relation)); - Assert(OidIsValid(RelationGetRelationId(relation))); + Assert(OidIsValid(RelationGetRelid(relation))); info = (LockInfo) relation->lockInfo; @@ -80,7 +80,7 @@ RelationInitLockInfo(Relation relation) info = (LockInfo) palloc(sizeof(LockInfoData)); MemoryContextSwitchTo(oldcxt); - info->lockRelId.relId = RelationGetRelationId(relation); + info->lockRelId.relId = RelationGetRelid(relation); if (IsSharedSystemRelationName(relname)) info->lockRelId.dbId = InvalidOid; else diff --git a/src/backend/storage/lmgr/multi.c b/src/backend/storage/lmgr/multi.c index 606ee4f560..0998389ffe 100644 --- a/src/backend/storage/lmgr/multi.c +++ b/src/backend/storage/lmgr/multi.c @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.21 1998/08/01 15:26:26 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.22 1998/08/19 02:02:44 momjian Exp $ * * NOTES: * (1) The lock.c module assumes that the caller here is doing @@ -248,7 +248,7 @@ MultiAcquire(LOCKMETHOD lockmethod, LOCKMODE lockmode, PG_LOCK_LEVEL level) { - LOCKMODE locks[N_LEVELS]; + LOCKMODE locks[N_LEVELS]; int i, status; LOCKTAG xxTag, diff --git a/src/backend/storage/smgr/mm.c b/src/backend/storage/smgr/mm.c index 8c8d229cb2..2f5b57a451 100644 --- a/src/backend/storage/smgr/mm.c +++ b/src/backend/storage/smgr/mm.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/smgr/Attic/mm.c,v 1.9 1998/06/23 15:35:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/smgr/Attic/mm.c,v 1.10 1998/08/19 02:02:46 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -181,7 +181,7 @@ mmcreate(Relation reln) (*MMCurRelno)++; - tag.mmrt_relid = reln->rd_id; + tag.mmrt_relid = RelationGetRelid(reln); if (reln->rd_rel->relisshared) tag.mmrt_dbid = (Oid) 0; else @@ -233,7 +233,7 @@ mmunlink(Relation reln) for (i = 0; i < MMNBUFFERS; i++) { if (MMBlockTags[i].mmct_dbid == reldbid - && MMBlockTags[i].mmct_relid == reln->rd_id) + && MMBlockTags[i].mmct_relid == RelationGetRelid(reln)) { entry = (MMHashEntry *) hash_search(MMCacheHT, (char *) &MMBlockTags[i], @@ -249,7 +249,7 @@ mmunlink(Relation reln) } } rtag.mmrt_dbid = reldbid; - rtag.mmrt_relid = reln->rd_id; + rtag.mmrt_relid = RelationGetRelid(reln); rentry = (MMRelHashEntry *) hash_search(MMRelCacheHT, (char *) &rtag, HASH_REMOVE, &found); @@ -290,7 +290,7 @@ mmextend(Relation reln, char *buffer) reldbid = MyDatabaseId; tag.mmct_dbid = rtag.mmrt_dbid = reldbid; - tag.mmct_relid = rtag.mmrt_relid = reln->rd_id; + tag.mmct_relid = rtag.mmrt_relid = RelationGetRelid(reln); SpinAcquire(MMCacheLock); @@ -334,7 +334,7 @@ mmextend(Relation reln, char *buffer) entry->mmhe_bufno = i; MMBlockTags[i].mmct_dbid = reldbid; - MMBlockTags[i].mmct_relid = reln->rd_id; + MMBlockTags[i].mmct_relid = RelationGetRelid(reln); MMBlockTags[i].mmct_blkno = rentry->mmrhe_nblocks; /* page numbers are zero-based, so we increment this at the end */ @@ -389,7 +389,7 @@ mmread(Relation reln, BlockNumber blocknum, char *buffer) else tag.mmct_dbid = MyDatabaseId; - tag.mmct_relid = reln->rd_id; + tag.mmct_relid = RelationGetRelid(reln); tag.mmct_blkno = blocknum; SpinAcquire(MMCacheLock); @@ -436,7 +436,7 @@ mmwrite(Relation reln, BlockNumber blocknum, char *buffer) else tag.mmct_dbid = MyDatabaseId; - tag.mmct_relid = reln->rd_id; + tag.mmct_relid = RelationGetRelid(reln); tag.mmct_blkno = blocknum; SpinAcquire(MMCacheLock); @@ -509,7 +509,7 @@ mmnblocks(Relation reln) else rtag.mmrt_dbid = MyDatabaseId; - rtag.mmrt_relid = reln->rd_id; + rtag.mmrt_relid = RelationGetRelid(reln); SpinAcquire(MMCacheLock); |
