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

Commit57d8080

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
TOAST
WARNING: This is actually broken - we have self-deadlocks due to concurrent changes in buffer management. Vadim and me are working on it.Jan
1 parentef5bea5 commit57d8080

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1640
-447
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.63 2000/07/02 22:00:24 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.64 2000/07/03 23:09:10 wieck Exp $
1313
*
1414
* NOTES
1515
* The old interface functions have been converted to macros
@@ -119,7 +119,11 @@ DataFill(char *data,
119119
{
120120
case-1:
121121
*infomask |=HEAP_HASVARLENA;
122-
data_length=VARSIZE(DatumGetPointer(value[i]));
122+
if (VARATT_IS_EXTERNAL(value[i]))
123+
*infomask |=HEAP_HASEXTERNAL;
124+
if (VARATT_IS_COMPRESSED(value[i]))
125+
*infomask |=HEAP_HASCOMPRESSED;
126+
data_length=VARATT_SIZE(DatumGetPointer(value[i]));
123127
memmove(data,DatumGetPointer(value[i]),data_length);
124128
break;
125129
casesizeof(char):
@@ -816,7 +820,7 @@ heap_freetuple(HeapTuple htup)
816820
if (htup->t_data!=NULL)
817821
if (htup->t_datamcxt!=NULL&& (char*) (htup->t_data)!=
818822
((char*)htup+HEAPTUPLESIZE))
819-
elog(NOTICE,"TELL Jan Wieck: heap_freetuple() found separatet_data");
823+
pfree(htup->t_data);
820824

821825
pfree(htup);
822826
}

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.65 2000/05/30 00:49:38 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.66 2000/07/03 23:09:10 wieck Exp $
1212
*
1313
* NOTES
1414
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -434,23 +434,16 @@ TupleDescInitEntry(TupleDesc desc,
434434

435435
att->attlen=typeLen(t);
436436
att->attbyval=typeByVal(t);
437-
att->attstorage='p';
438437
}
439438
else
440439
{
441440
att->attlen=typeForm->typlen;
442441
att->attbyval=typeForm->typbyval;
443442
/*
444-
* This will enable ALL variable size attributes of user
445-
* relations for automatic move off into "secondary" relation.
446-
* Jan
443+
* Default to the types storage
447444
*/
448445
#ifdefTUPLE_TOASTER_ACTIVE
449-
#ifdefTUPLE_TOASTER_ALL_TYPES
450-
att->attstorage= (att->attlen==-1) ?'e' :'p';
451-
#else
452-
att->attstorage='p';
453-
#endif
446+
att->attstorage=typeForm->typstorage;
454447
#else
455448
att->attstorage='p';
456449
#endif

‎src/backend/access/gist/gist.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.59 2000/06/17 23:41:12 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.60 2000/07/03 23:09:11 wieck Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -546,7 +546,7 @@ gistAdjustKeys(Relation r,
546546
oldud+=sizeof(IndexTupleData);
547547

548548
evec= (bytea*)palloc(2*sizeof(GISTENTRY)+VARHDRSZ);
549-
VARSIZE(evec)=2*sizeof(GISTENTRY)+VARHDRSZ;
549+
VARATT_SIZEP(evec)=2*sizeof(GISTENTRY)+VARHDRSZ;
550550

551551
/* insert decompressed oldud into entry vector */
552552
gistdentryinit(giststate,&((GISTENTRY*)VARDATA(evec))[0],
@@ -741,7 +741,7 @@ gistSplit(Relation r,
741741
else
742742
decompvec[maxoff+1]= FALSE;
743743

744-
VARSIZE(entryvec)= (maxoff+2)*sizeof(GISTENTRY)+VARHDRSZ;
744+
VARATT_SIZEP(entryvec)= (maxoff+2)*sizeof(GISTENTRY)+VARHDRSZ;
745745

746746
/* now let the user-defined picksplit function set up the split vector */
747747
FunctionCall2(&giststate->picksplitFn,

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

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.75 2000/07/0302:54:15 vadim Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.76 2000/07/0323:09:16 wieck Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1299,6 +1299,17 @@ heap_insert(Relation relation, HeapTuple tup)
12991299
tup->t_data->t_infomask &= ~(HEAP_XACT_MASK);
13001300
tup->t_data->t_infomask |=HEAP_XMAX_INVALID;
13011301

1302+
#ifdefTUPLE_TOASTER_ACTIVE
1303+
/* ----------
1304+
* If the new tuple is too big for storage or contains already
1305+
* toasted attributes from some other relation, invoke the toaster.
1306+
* ----------
1307+
*/
1308+
if (HeapTupleHasExtended(tup)||
1309+
(MAXALIGN(tup->t_len)> (MaxTupleSize /4)))
1310+
heap_tuple_toast_attrs(relation,tup,NULL);
1311+
#endif
1312+
13021313
/* Find buffer for this tuple */
13031314
buffer=RelationGetBufferForTuple(relation,tup->t_len,InvalidBuffer);
13041315

@@ -1328,8 +1339,8 @@ heap_insert(Relation relation, HeapTuple tup)
13281339
}
13291340
#endif
13301341

1331-
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
13321342
WriteBuffer(buffer);
1343+
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
13331344

13341345
if (IsSystemRelationName(RelationGetRelationName(relation)))
13351346
RelationMark4RollbackHeapTuple(relation,tup);
@@ -1441,6 +1452,16 @@ heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid)
14411452
tp.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
14421453
HEAP_XMAX_INVALID |HEAP_MARKED_FOR_UPDATE);
14431454

1455+
#ifdefTUPLE_TOASTER_ACTIVE
1456+
/* ----------
1457+
* If the relation has toastable attributes, we need to delete
1458+
* no longer needed items there too.
1459+
* ----------
1460+
*/
1461+
if (HeapTupleHasExtended(&tp))
1462+
heap_tuple_toast_attrs(relation,NULL,&(tp));
1463+
#endif
1464+
14441465
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
14451466

14461467
/* invalidate caches */
@@ -1559,6 +1580,19 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
15591580
oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
15601581
HEAP_XMAX_INVALID |HEAP_MARKED_FOR_UPDATE);
15611582

1583+
#ifdefTUPLE_TOASTER_ACTIVE
1584+
/* ----------
1585+
* If this relation is enabled for toasting, let the toaster
1586+
* delete not any longer needed entries and create new ones to
1587+
* make the new tuple fit again.
1588+
* ----------
1589+
*/
1590+
if (HeapTupleHasExtended(&oldtup)||
1591+
HeapTupleHasExtended(newtup)||
1592+
(MAXALIGN(newtup->t_len)> (MaxTupleSize /4)))
1593+
heap_tuple_toast_attrs(relation,newtup,&oldtup);
1594+
#endif
1595+
15621596
/* record address of new tuple in t_ctid of old one */
15631597
oldtup.t_data->t_ctid=newtup->t_self;
15641598

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp