1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00
WARNING: This is actually broken - we have self-deadlocks
	         due to concurrent changes in buffer management.
			 Vadim and me are working on it.

Jan
This commit is contained in:
Jan Wieck
2000-07-03 23:10:14 +00:00
parent ef5bea51e1
commit 57d8080a40
43 changed files with 1638 additions and 445 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.63 2000/07/02 22:00:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.64 2000/07/03 23:09:10 wieck Exp $
*
* NOTES
* The old interface functions have been converted to macros
@@ -119,7 +119,11 @@ DataFill(char *data,
{
case -1:
*infomask |= HEAP_HASVARLENA;
data_length = VARSIZE(DatumGetPointer(value[i]));
if (VARATT_IS_EXTERNAL(value[i]))
*infomask |= HEAP_HASEXTERNAL;
if (VARATT_IS_COMPRESSED(value[i]))
*infomask |= HEAP_HASCOMPRESSED;
data_length = VARATT_SIZE(DatumGetPointer(value[i]));
memmove(data, DatumGetPointer(value[i]), data_length);
break;
case sizeof(char):
@@ -816,7 +820,7 @@ heap_freetuple(HeapTuple htup)
if (htup->t_data != NULL)
if (htup->t_datamcxt != NULL && (char *) (htup->t_data) !=
((char *) htup + HEAPTUPLESIZE))
elog(NOTICE, "TELL Jan Wieck: heap_freetuple() found separate t_data");
pfree(htup->t_data);
pfree(htup);
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.65 2000/05/30 00:49:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.66 2000/07/03 23:09:10 wieck Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -434,23 +434,16 @@ TupleDescInitEntry(TupleDesc desc,
att->attlen = typeLen(t);
att->attbyval = typeByVal(t);
att->attstorage = 'p';
}
else
{
att->attlen = typeForm->typlen;
att->attbyval = typeForm->typbyval;
/*
* This will enable ALL variable size attributes of user
* relations for automatic move off into "secondary" relation.
* Jan
* Default to the types storage
*/
#ifdef TUPLE_TOASTER_ACTIVE
#ifdef TUPLE_TOASTER_ALL_TYPES
att->attstorage = (att->attlen == -1) ? 'e' : 'p';
#else
att->attstorage = 'p';
#endif
att->attstorage = typeForm->typstorage;
#else
att->attstorage = 'p';
#endif

View File

@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.59 2000/06/17 23:41:12 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.60 2000/07/03 23:09:11 wieck Exp $
*
*-------------------------------------------------------------------------
*/
@@ -546,7 +546,7 @@ gistAdjustKeys(Relation r,
oldud += sizeof(IndexTupleData);
evec = (bytea *) palloc(2 * sizeof(GISTENTRY) + VARHDRSZ);
VARSIZE(evec) = 2 * sizeof(GISTENTRY) + VARHDRSZ;
VARATT_SIZEP(evec) = 2 * sizeof(GISTENTRY) + VARHDRSZ;
/* insert decompressed oldud into entry vector */
gistdentryinit(giststate, &((GISTENTRY *) VARDATA(evec))[0],
@@ -741,7 +741,7 @@ gistSplit(Relation r,
else
decompvec[maxoff + 1] = FALSE;
VARSIZE(entryvec) = (maxoff + 2) * sizeof(GISTENTRY) + VARHDRSZ;
VARATT_SIZEP(entryvec) = (maxoff + 2) * sizeof(GISTENTRY) + VARHDRSZ;
/* now let the user-defined picksplit function set up the split vector */
FunctionCall2(&giststate->picksplitFn,

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.75 2000/07/03 02:54:15 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.76 2000/07/03 23:09:16 wieck Exp $
*
*
* INTERFACE ROUTINES
@@ -1299,6 +1299,17 @@ heap_insert(Relation relation, HeapTuple tup)
tup->t_data->t_infomask &= ~(HEAP_XACT_MASK);
tup->t_data->t_infomask |= HEAP_XMAX_INVALID;
#ifdef TUPLE_TOASTER_ACTIVE
/* ----------
* If the new tuple is too big for storage or contains already
* toasted attributes from some other relation, invoke the toaster.
* ----------
*/
if (HeapTupleHasExtended(tup) ||
(MAXALIGN(tup->t_len) > (MaxTupleSize / 4)))
heap_tuple_toast_attrs(relation, tup, NULL);
#endif
/* Find buffer for this tuple */
buffer = RelationGetBufferForTuple(relation, tup->t_len, InvalidBuffer);
@@ -1328,8 +1339,8 @@ heap_insert(Relation relation, HeapTuple tup)
}
#endif
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
WriteBuffer(buffer);
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
if (IsSystemRelationName(RelationGetRelationName(relation)))
RelationMark4RollbackHeapTuple(relation, tup);
@@ -1441,6 +1452,16 @@ l1:
tp.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
#ifdef TUPLE_TOASTER_ACTIVE
/* ----------
* If the relation has toastable attributes, we need to delete
* no longer needed items there too.
* ----------
*/
if (HeapTupleHasExtended(&tp))
heap_tuple_toast_attrs(relation, NULL, &(tp));
#endif
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
/* invalidate caches */
@@ -1559,6 +1580,19 @@ l2:
oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
#ifdef TUPLE_TOASTER_ACTIVE
/* ----------
* If this relation is enabled for toasting, let the toaster
* delete not any longer needed entries and create new ones to
* make the new tuple fit again.
* ----------
*/
if (HeapTupleHasExtended(&oldtup) ||
HeapTupleHasExtended(newtup) ||
(MAXALIGN(newtup->t_len) > (MaxTupleSize / 4)))
heap_tuple_toast_attrs(relation, newtup, &oldtup);
#endif
/* record address of new tuple in t_ctid of old one */
oldtup.t_data->t_ctid = newtup->t_self;

File diff suppressed because it is too large Load Diff