Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd218ae

Browse files
committed
Remove the t_datamcxt field of HeapTupleData. This was introduced for
the convenience of tuptoaster.c and is no longer needed, so may as wellget rid of some small amount of overhead.
1 parent40314f2 commitdd218ae

File tree

13 files changed

+24
-66
lines changed

13 files changed

+24
-66
lines changed

‎src/backend/access/common/heaptuple.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*
1818
* IDENTIFICATION
19-
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.102 2005/10/19 22:30:30 tgl Exp $
19+
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.103 2005/11/20 19:49:06 tgl Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -623,7 +623,6 @@ heap_copytuple(HeapTuple tuple)
623623
newTuple->t_len=tuple->t_len;
624624
newTuple->t_self=tuple->t_self;
625625
newTuple->t_tableOid=tuple->t_tableOid;
626-
newTuple->t_datamcxt=CurrentMemoryContext;
627626
newTuple->t_data= (HeapTupleHeader) ((char*)newTuple+HEAPTUPLESIZE);
628627
memcpy((char*)newTuple->t_data, (char*)tuple->t_data,tuple->t_len);
629628
returnnewTuple;
@@ -647,7 +646,6 @@ heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest)
647646
dest->t_len=src->t_len;
648647
dest->t_self=src->t_self;
649648
dest->t_tableOid=src->t_tableOid;
650-
dest->t_datamcxt=CurrentMemoryContext;
651649
dest->t_data= (HeapTupleHeader)palloc(src->t_len);
652650
memcpy((char*)dest->t_data, (char*)src->t_data,src->t_len);
653651
}
@@ -725,7 +723,6 @@ heap_form_tuple(TupleDesc tupleDescriptor,
725723
* HeapTupleData management structure are allocated in one chunk.
726724
*/
727725
tuple= (HeapTuple)palloc0(HEAPTUPLESIZE+len);
728-
tuple->t_datamcxt=CurrentMemoryContext;
729726
tuple->t_data=td= (HeapTupleHeader) ((char*)tuple+HEAPTUPLESIZE);
730727

731728
/*
@@ -833,7 +830,6 @@ heap_formtuple(TupleDesc tupleDescriptor,
833830
* HeapTupleData management structure are allocated in one chunk.
834831
*/
835832
tuple= (HeapTuple)palloc0(HEAPTUPLESIZE+len);
836-
tuple->t_datamcxt=CurrentMemoryContext;
837833
tuple->t_data=td= (HeapTupleHeader) ((char*)tuple+HEAPTUPLESIZE);
838834

839835
/*
@@ -1516,11 +1512,6 @@ slot_attisnull(TupleTableSlot *slot, int attnum)
15161512
void
15171513
heap_freetuple(HeapTuplehtup)
15181514
{
1519-
if (htup->t_data!=NULL)
1520-
if (htup->t_datamcxt!=NULL&& (char*) (htup->t_data)!=
1521-
((char*)htup+HEAPTUPLESIZE))
1522-
pfree(htup->t_data);
1523-
15241515
pfree(htup);
15251516
}
15261517

@@ -1559,7 +1550,6 @@ heap_addheader(int natts,/* max domain index */
15591550
len=hoff+structlen;
15601551

15611552
tuple= (HeapTuple)palloc0(HEAPTUPLESIZE+len);
1562-
tuple->t_datamcxt=CurrentMemoryContext;
15631553
tuple->t_data=td= (HeapTupleHeader) ((char*)tuple+HEAPTUPLESIZE);
15641554

15651555
tuple->t_len=len;

‎src/backend/access/heap/heapam.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.201 2005/11/2018:38:20 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.202 2005/11/2019:49:07 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -78,7 +78,6 @@ initscan(HeapScanDesc scan, ScanKey key)
7878
*/
7979
scan->rs_nblocks=RelationGetNumberOfBlocks(scan->rs_rd);
8080

81-
scan->rs_ctup.t_datamcxt=NULL;
8281
scan->rs_ctup.t_data=NULL;
8382
scan->rs_cbuf=InvalidBuffer;
8483

@@ -129,8 +128,9 @@ heapgettup(Relation relation,
129128
/*
130129
* debugging stuff
131130
*
132-
* check validity of arguments, here and for other functions too Note: no
133-
* locking manipulations needed--this is a local function
131+
* check validity of arguments, here and for other functions too
132+
*
133+
* Note: no locking manipulations needed--this is a local function
134134
*/
135135
#ifdefHEAPDEBUGALL
136136
if (ItemPointerIsValid(tid))
@@ -164,7 +164,6 @@ heapgettup(Relation relation,
164164
if (BufferIsValid(*buffer))
165165
ReleaseBuffer(*buffer);
166166
*buffer=InvalidBuffer;
167-
tuple->t_datamcxt=NULL;
168167
tuple->t_data=NULL;
169168
return;
170169
}
@@ -182,7 +181,6 @@ heapgettup(Relation relation,
182181
if (BufferIsValid(*buffer))
183182
ReleaseBuffer(*buffer);
184183
*buffer=InvalidBuffer;
185-
tuple->t_datamcxt=NULL;
186184
tuple->t_data=NULL;
187185
return;
188186
}
@@ -197,7 +195,6 @@ heapgettup(Relation relation,
197195
lineoff=ItemPointerGetOffsetNumber(tid);
198196
lpp=PageGetItemId(dp,lineoff);
199197

200-
tuple->t_datamcxt=NULL;
201198
tuple->t_data= (HeapTupleHeader)PageGetItem((Page)dp,lpp);
202199
tuple->t_len=ItemIdGetLength(lpp);
203200
LockBuffer(*buffer,BUFFER_LOCK_UNLOCK);
@@ -293,7 +290,6 @@ heapgettup(Relation relation,
293290
{
294291
boolvalid;
295292

296-
tuple->t_datamcxt=NULL;
297293
tuple->t_data= (HeapTupleHeader)PageGetItem((Page)dp,lpp);
298294
tuple->t_len=ItemIdGetLength(lpp);
299295
ItemPointerSet(&(tuple->t_self),page,lineoff);
@@ -340,7 +336,6 @@ heapgettup(Relation relation,
340336
if (BufferIsValid(*buffer))
341337
ReleaseBuffer(*buffer);
342338
*buffer=InvalidBuffer;
343-
tuple->t_datamcxt=NULL;
344339
tuple->t_data=NULL;
345340
return;
346341
}
@@ -872,7 +867,6 @@ heap_release_fetch(Relation relation,
872867
ReleaseBuffer(buffer);
873868
*userbuf=InvalidBuffer;
874869
}
875-
tuple->t_datamcxt=NULL;
876870
tuple->t_data=NULL;
877871
return false;
878872
}
@@ -895,15 +889,13 @@ heap_release_fetch(Relation relation,
895889
ReleaseBuffer(buffer);
896890
*userbuf=InvalidBuffer;
897891
}
898-
tuple->t_datamcxt=NULL;
899892
tuple->t_data=NULL;
900893
return false;
901894
}
902895

903896
/*
904897
* fill in *tuple fields
905898
*/
906-
tuple->t_datamcxt=NULL;
907899
tuple->t_data= (HeapTupleHeader)PageGetItem((Page)dp,lp);
908900
tuple->t_len=ItemIdGetLength(lp);
909901
tuple->t_tableOid=RelationGetRelid(relation);
@@ -1027,7 +1019,6 @@ heap_get_latest_tid(Relation relation,
10271019

10281020
/* OK to access the tuple */
10291021
tp.t_self=ctid;
1030-
tp.t_datamcxt=NULL;
10311022
tp.t_data= (HeapTupleHeader)PageGetItem(dp,lp);
10321023
tp.t_len=ItemIdGetLength(lp);
10331024

@@ -1303,7 +1294,6 @@ heap_delete(Relation relation, ItemPointer tid,
13031294
dp= (PageHeader)BufferGetPage(buffer);
13041295
lp=PageGetItemId(dp,ItemPointerGetOffsetNumber(tid));
13051296

1306-
tp.t_datamcxt=NULL;
13071297
tp.t_data= (HeapTupleHeader)PageGetItem(dp,lp);
13081298
tp.t_len=ItemIdGetLength(lp);
13091299
tp.t_self=*tid;
@@ -1612,7 +1602,6 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
16121602
dp= (PageHeader)BufferGetPage(buffer);
16131603
lp=PageGetItemId(dp,ItemPointerGetOffsetNumber(otid));
16141604

1615-
oldtup.t_datamcxt=NULL;
16161605
oldtup.t_data= (HeapTupleHeader)PageGetItem(dp,lp);
16171606
oldtup.t_len=ItemIdGetLength(lp);
16181607
oldtup.t_self=*otid;
@@ -2093,7 +2082,6 @@ heap_lock_tuple(Relation relation, HeapTuple tuple, Buffer *buffer,
20932082
lp=PageGetItemId(dp,ItemPointerGetOffsetNumber(tid));
20942083
Assert(ItemIdIsUsed(lp));
20952084

2096-
tuple->t_datamcxt=NULL;
20972085
tuple->t_data= (HeapTupleHeader)PageGetItem((Page)dp,lp);
20982086
tuple->t_len=ItemIdGetLength(lp);
20992087
tuple->t_tableOid=RelationGetRelid(relation);
@@ -2476,13 +2464,11 @@ heap_restrpos(HeapScanDesc scan)
24762464

24772465
if (!ItemPointerIsValid(&scan->rs_mctid))
24782466
{
2479-
scan->rs_ctup.t_datamcxt=NULL;
24802467
scan->rs_ctup.t_data=NULL;
24812468
}
24822469
else
24832470
{
24842471
scan->rs_ctup.t_self=scan->rs_mctid;
2485-
scan->rs_ctup.t_datamcxt=NULL;
24862472
scan->rs_ctup.t_data= (HeapTupleHeader)0x1;/* for heapgettup */
24872473
heapgettup(scan->rs_rd,
24882474
0,

‎src/backend/access/heap/tuptoaster.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.54 2005/11/2018:38:20 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.55 2005/11/2019:49:07 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -774,7 +774,6 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
774774
result_tuple->t_len=new_len;
775775
result_tuple->t_self=newtup->t_self;
776776
result_tuple->t_tableOid=newtup->t_tableOid;
777-
result_tuple->t_datamcxt=CurrentMemoryContext;
778777
new_data= (HeapTupleHeader) ((char*)result_tuple+HEAPTUPLESIZE);
779778
result_tuple->t_data=new_data;
780779

‎src/backend/access/index/genam.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.49 2005/10/15 02:49:09 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.50 2005/11/20 19:49:07 tgl Exp $
1212
*
1313
* NOTES
1414
* many of the old access method routines have been turned into
@@ -98,7 +98,6 @@ RelationGetIndexScan(Relation indexRelation,
9898
ItemPointerSetInvalid(&scan->currentMarkData);
9999

100100
ItemPointerSetInvalid(&scan->xs_ctup.t_self);
101-
scan->xs_ctup.t_datamcxt=NULL;
102101
scan->xs_ctup.t_data=NULL;
103102
scan->xs_cbuf=InvalidBuffer;
104103

‎src/backend/commands/trigger.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.195 2005/10/15 02:49:15 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.196 2005/11/20 19:49:07 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1769,7 +1769,6 @@ ltrmark:;
17691769

17701770
Assert(ItemIdIsUsed(lp));
17711771

1772-
tuple.t_datamcxt=NULL;
17731772
tuple.t_data= (HeapTupleHeader)PageGetItem((Page)dp,lp);
17741773
tuple.t_len=ItemIdGetLength(lp);
17751774
tuple.t_self=*tid;

‎src/backend/commands/vacuum.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.317 2005/10/15 02:49:16 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.318 2005/11/20 19:49:07 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -1338,7 +1338,6 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
13381338
continue;
13391339
}
13401340

1341-
tuple.t_datamcxt=NULL;
13421341
tuple.t_data= (HeapTupleHeader)PageGetItem(page,itemid);
13431342
tuple.t_len=ItemIdGetLength(itemid);
13441343
ItemPointerSet(&(tuple.t_self),blkno,offnum);
@@ -1758,7 +1757,6 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
17581757
if (!ItemIdIsUsed(itemid))
17591758
continue;
17601759

1761-
tuple.t_datamcxt=NULL;
17621760
tuple.t_data= (HeapTupleHeader)PageGetItem(page,itemid);
17631761
tuple_len=tuple.t_len=ItemIdGetLength(itemid);
17641762
ItemPointerSet(&(tuple.t_self),blkno,offnum);
@@ -1937,7 +1935,6 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
19371935
break;
19381936
}
19391937
/* OK, switch our attention to the next tuple in chain */
1940-
tp.t_datamcxt=NULL;
19411938
tp.t_data=nextTdata;
19421939
tp.t_self=nextTid;
19431940
tlen=tp.t_len=ItemIdGetLength(nextItemid);
@@ -2064,7 +2061,6 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
20642061
chain_move_failed= true;
20652062
break;/* out of check-all-items loop */
20662063
}
2067-
tp.t_datamcxt=NULL;
20682064
tp.t_data=PTdata;
20692065
tlen=tp.t_len=ItemIdGetLength(Pitemid);
20702066
if (freeCbuf)
@@ -2122,7 +2118,6 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
21222118

21232119
Citemid=PageGetItemId(Cpage,
21242120
ItemPointerGetOffsetNumber(&(tuple.t_self)));
2125-
tuple.t_datamcxt=NULL;
21262121
tuple.t_data= (HeapTupleHeader)PageGetItem(Cpage,Citemid);
21272122
tuple_len=tuple.t_len=ItemIdGetLength(Citemid);
21282123

@@ -2582,7 +2577,6 @@ move_chain_tuple(Relation rel,
25822577
newitemid=PageGetItemId(dst_page,newoff);
25832578
/* drop temporary copy, and point to the version on the dest page */
25842579
pfree(newtup.t_data);
2585-
newtup.t_datamcxt=NULL;
25862580
newtup.t_data= (HeapTupleHeader)PageGetItem(dst_page,newitemid);
25872581

25882582
ItemPointerSet(&(newtup.t_self),dst_vacpage->blkno,newoff);
@@ -2692,7 +2686,6 @@ move_plain_tuple(Relation rel,
26922686
dst_vacpage->offsets_used,dst_vacpage->offsets_free);
26932687
newitemid=PageGetItemId(dst_page,newoff);
26942688
pfree(newtup.t_data);
2695-
newtup.t_datamcxt=NULL;
26962689
newtup.t_data= (HeapTupleHeader)PageGetItem(dst_page,newitemid);
26972690
ItemPointerSet(&(newtup.t_data->t_ctid),dst_vacpage->blkno,newoff);
26982691
newtup.t_self=newtup.t_data->t_ctid;

‎src/backend/commands/vacuumlazy.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
*
3333
* IDENTIFICATION
34-
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.61 2005/10/15 02:49:16 momjian Exp $
34+
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.62 2005/11/20 19:49:07 tgl Exp $
3535
*
3636
*-------------------------------------------------------------------------
3737
*/
@@ -349,7 +349,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
349349
continue;
350350
}
351351

352-
tuple.t_datamcxt=NULL;
353352
tuple.t_data= (HeapTupleHeader)PageGetItem(page,itemid);
354353
tuple.t_len=ItemIdGetLength(itemid);
355354
ItemPointerSet(&(tuple.t_self),blkno,offnum);
@@ -885,7 +884,6 @@ count_nondeletable_pages(Relation onerel, LVRelStats *vacrelstats)
885884
if (!ItemIdIsUsed(itemid))
886885
continue;
887886

888-
tuple.t_datamcxt=NULL;
889887
tuple.t_data= (HeapTupleHeader)PageGetItem(page,itemid);
890888
tuple.t_len=ItemIdGetLength(itemid);
891889
ItemPointerSet(&(tuple.t_self),blkno,offnum);

‎src/backend/executor/nodeHash.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.96 2005/10/15 02:49:17 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.97 2005/11/20 19:49:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -621,7 +621,6 @@ ExecHashTableInsert(HashJoinTable hashtable,
621621
memcpy((char*)&hashTuple->htup,
622622
(char*)tuple,
623623
sizeof(hashTuple->htup));
624-
hashTuple->htup.t_datamcxt=hashtable->batchCxt;
625624
hashTuple->htup.t_data= (HeapTupleHeader)
626625
(((char*)hashTuple)+MAXALIGN(sizeof(HashJoinTupleData)));
627626
memcpy((char*)hashTuple->htup.t_data,

‎src/backend/executor/nodeHashjoin.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.75 2005/10/18 01:06:24 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.76 2005/11/20 19:49:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -789,7 +789,6 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
789789
errmsg("could not read from hash-join temporary file: %m")));
790790
heapTuple=palloc(HEAPTUPLESIZE+htup.t_len);
791791
memcpy((char*)heapTuple, (char*)&htup,sizeof(HeapTupleData));
792-
heapTuple->t_datamcxt=CurrentMemoryContext;
793792
heapTuple->t_data= (HeapTupleHeader)
794793
((char*)heapTuple+HEAPTUPLESIZE);
795794
nread=BufFileRead(file, (void*)heapTuple->t_data,htup.t_len);

‎src/backend/utils/cache/relcache.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.230 2005/10/15 02:49:31 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.231 2005/11/20 19:49:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2998,7 +2998,6 @@ load_relcache_init_file(void)
29982998
gotoread_failed;
29992999

30003000
/* Fix up internal pointers in the tuple -- see heap_copytuple */
3001-
rel->rd_indextuple->t_datamcxt=CurrentMemoryContext;
30023001
rel->rd_indextuple->t_data= (HeapTupleHeader) ((char*)rel->rd_indextuple+HEAPTUPLESIZE);
30033002
rel->rd_index= (Form_pg_index)GETSTRUCT(rel->rd_indextuple);
30043003

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp