mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Remove the t_datamcxt field of HeapTupleData. This was introduced for
the convenience of tuptoaster.c and is no longer needed, so may as well get rid of some small amount of overhead.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.102 2005/10/19 22:30:30 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.103 2005/11/20 19:49:06 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -623,7 +623,6 @@ heap_copytuple(HeapTuple tuple)
|
||||
newTuple->t_len = tuple->t_len;
|
||||
newTuple->t_self = tuple->t_self;
|
||||
newTuple->t_tableOid = tuple->t_tableOid;
|
||||
newTuple->t_datamcxt = CurrentMemoryContext;
|
||||
newTuple->t_data = (HeapTupleHeader) ((char *) newTuple + HEAPTUPLESIZE);
|
||||
memcpy((char *) newTuple->t_data, (char *) tuple->t_data, tuple->t_len);
|
||||
return newTuple;
|
||||
@@ -647,7 +646,6 @@ heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest)
|
||||
dest->t_len = src->t_len;
|
||||
dest->t_self = src->t_self;
|
||||
dest->t_tableOid = src->t_tableOid;
|
||||
dest->t_datamcxt = CurrentMemoryContext;
|
||||
dest->t_data = (HeapTupleHeader) palloc(src->t_len);
|
||||
memcpy((char *) dest->t_data, (char *) src->t_data, src->t_len);
|
||||
}
|
||||
@@ -725,7 +723,6 @@ heap_form_tuple(TupleDesc tupleDescriptor,
|
||||
* HeapTupleData management structure are allocated in one chunk.
|
||||
*/
|
||||
tuple = (HeapTuple) palloc0(HEAPTUPLESIZE + len);
|
||||
tuple->t_datamcxt = CurrentMemoryContext;
|
||||
tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
|
||||
|
||||
/*
|
||||
@@ -833,7 +830,6 @@ heap_formtuple(TupleDesc tupleDescriptor,
|
||||
* HeapTupleData management structure are allocated in one chunk.
|
||||
*/
|
||||
tuple = (HeapTuple) palloc0(HEAPTUPLESIZE + len);
|
||||
tuple->t_datamcxt = CurrentMemoryContext;
|
||||
tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
|
||||
|
||||
/*
|
||||
@@ -1516,11 +1512,6 @@ slot_attisnull(TupleTableSlot *slot, int attnum)
|
||||
void
|
||||
heap_freetuple(HeapTuple htup)
|
||||
{
|
||||
if (htup->t_data != NULL)
|
||||
if (htup->t_datamcxt != NULL && (char *) (htup->t_data) !=
|
||||
((char *) htup + HEAPTUPLESIZE))
|
||||
pfree(htup->t_data);
|
||||
|
||||
pfree(htup);
|
||||
}
|
||||
|
||||
@@ -1559,7 +1550,6 @@ heap_addheader(int natts, /* max domain index */
|
||||
len = hoff + structlen;
|
||||
|
||||
tuple = (HeapTuple) palloc0(HEAPTUPLESIZE + len);
|
||||
tuple->t_datamcxt = CurrentMemoryContext;
|
||||
tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
|
||||
|
||||
tuple->t_len = len;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.201 2005/11/20 18:38:20 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.202 2005/11/20 19:49:07 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@@ -78,7 +78,6 @@ initscan(HeapScanDesc scan, ScanKey key)
|
||||
*/
|
||||
scan->rs_nblocks = RelationGetNumberOfBlocks(scan->rs_rd);
|
||||
|
||||
scan->rs_ctup.t_datamcxt = NULL;
|
||||
scan->rs_ctup.t_data = NULL;
|
||||
scan->rs_cbuf = InvalidBuffer;
|
||||
|
||||
@@ -129,8 +128,9 @@ heapgettup(Relation relation,
|
||||
/*
|
||||
* debugging stuff
|
||||
*
|
||||
* check validity of arguments, here and for other functions too Note: no
|
||||
* locking manipulations needed--this is a local function
|
||||
* check validity of arguments, here and for other functions too
|
||||
*
|
||||
* Note: no locking manipulations needed--this is a local function
|
||||
*/
|
||||
#ifdef HEAPDEBUGALL
|
||||
if (ItemPointerIsValid(tid))
|
||||
@@ -164,7 +164,6 @@ heapgettup(Relation relation,
|
||||
if (BufferIsValid(*buffer))
|
||||
ReleaseBuffer(*buffer);
|
||||
*buffer = InvalidBuffer;
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -182,7 +181,6 @@ heapgettup(Relation relation,
|
||||
if (BufferIsValid(*buffer))
|
||||
ReleaseBuffer(*buffer);
|
||||
*buffer = InvalidBuffer;
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -197,7 +195,6 @@ heapgettup(Relation relation,
|
||||
lineoff = ItemPointerGetOffsetNumber(tid);
|
||||
lpp = PageGetItemId(dp, lineoff);
|
||||
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lpp);
|
||||
tuple->t_len = ItemIdGetLength(lpp);
|
||||
LockBuffer(*buffer, BUFFER_LOCK_UNLOCK);
|
||||
@@ -293,7 +290,6 @@ heapgettup(Relation relation,
|
||||
{
|
||||
bool valid;
|
||||
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lpp);
|
||||
tuple->t_len = ItemIdGetLength(lpp);
|
||||
ItemPointerSet(&(tuple->t_self), page, lineoff);
|
||||
@@ -340,7 +336,6 @@ heapgettup(Relation relation,
|
||||
if (BufferIsValid(*buffer))
|
||||
ReleaseBuffer(*buffer);
|
||||
*buffer = InvalidBuffer;
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -872,7 +867,6 @@ heap_release_fetch(Relation relation,
|
||||
ReleaseBuffer(buffer);
|
||||
*userbuf = InvalidBuffer;
|
||||
}
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = NULL;
|
||||
return false;
|
||||
}
|
||||
@@ -895,7 +889,6 @@ heap_release_fetch(Relation relation,
|
||||
ReleaseBuffer(buffer);
|
||||
*userbuf = InvalidBuffer;
|
||||
}
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = NULL;
|
||||
return false;
|
||||
}
|
||||
@@ -903,7 +896,6 @@ heap_release_fetch(Relation relation,
|
||||
/*
|
||||
* fill in *tuple fields
|
||||
*/
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
|
||||
tuple->t_len = ItemIdGetLength(lp);
|
||||
tuple->t_tableOid = RelationGetRelid(relation);
|
||||
@@ -1027,7 +1019,6 @@ heap_get_latest_tid(Relation relation,
|
||||
|
||||
/* OK to access the tuple */
|
||||
tp.t_self = ctid;
|
||||
tp.t_datamcxt = NULL;
|
||||
tp.t_data = (HeapTupleHeader) PageGetItem(dp, lp);
|
||||
tp.t_len = ItemIdGetLength(lp);
|
||||
|
||||
@@ -1303,7 +1294,6 @@ heap_delete(Relation relation, ItemPointer tid,
|
||||
dp = (PageHeader) BufferGetPage(buffer);
|
||||
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid));
|
||||
|
||||
tp.t_datamcxt = NULL;
|
||||
tp.t_data = (HeapTupleHeader) PageGetItem(dp, lp);
|
||||
tp.t_len = ItemIdGetLength(lp);
|
||||
tp.t_self = *tid;
|
||||
@@ -1612,7 +1602,6 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
|
||||
dp = (PageHeader) BufferGetPage(buffer);
|
||||
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(otid));
|
||||
|
||||
oldtup.t_datamcxt = NULL;
|
||||
oldtup.t_data = (HeapTupleHeader) PageGetItem(dp, lp);
|
||||
oldtup.t_len = ItemIdGetLength(lp);
|
||||
oldtup.t_self = *otid;
|
||||
@@ -2093,7 +2082,6 @@ heap_lock_tuple(Relation relation, HeapTuple tuple, Buffer *buffer,
|
||||
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid));
|
||||
Assert(ItemIdIsUsed(lp));
|
||||
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
|
||||
tuple->t_len = ItemIdGetLength(lp);
|
||||
tuple->t_tableOid = RelationGetRelid(relation);
|
||||
@@ -2476,13 +2464,11 @@ heap_restrpos(HeapScanDesc scan)
|
||||
|
||||
if (!ItemPointerIsValid(&scan->rs_mctid))
|
||||
{
|
||||
scan->rs_ctup.t_datamcxt = NULL;
|
||||
scan->rs_ctup.t_data = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
scan->rs_ctup.t_self = scan->rs_mctid;
|
||||
scan->rs_ctup.t_datamcxt = NULL;
|
||||
scan->rs_ctup.t_data = (HeapTupleHeader) 0x1; /* for heapgettup */
|
||||
heapgettup(scan->rs_rd,
|
||||
0,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.54 2005/11/20 18:38:20 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.55 2005/11/20 19:49:07 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@@ -774,7 +774,6 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
|
||||
result_tuple->t_len = new_len;
|
||||
result_tuple->t_self = newtup->t_self;
|
||||
result_tuple->t_tableOid = newtup->t_tableOid;
|
||||
result_tuple->t_datamcxt = CurrentMemoryContext;
|
||||
new_data = (HeapTupleHeader) ((char *) result_tuple + HEAPTUPLESIZE);
|
||||
result_tuple->t_data = new_data;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.49 2005/10/15 02:49:09 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.50 2005/11/20 19:49:07 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* many of the old access method routines have been turned into
|
||||
@@ -98,7 +98,6 @@ RelationGetIndexScan(Relation indexRelation,
|
||||
ItemPointerSetInvalid(&scan->currentMarkData);
|
||||
|
||||
ItemPointerSetInvalid(&scan->xs_ctup.t_self);
|
||||
scan->xs_ctup.t_datamcxt = NULL;
|
||||
scan->xs_ctup.t_data = NULL;
|
||||
scan->xs_cbuf = InvalidBuffer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user