aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/heap')
-rw-r--r--src/backend/access/heap/heapam.c84
-rw-r--r--src/backend/access/heap/hio.c26
-rw-r--r--src/backend/access/heap/tuptoaster.c12
3 files changed, 65 insertions, 57 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index d51705fa472..29d6c9e0f9e 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.66 2000/02/09 03:49:47 inoue Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.67 2000/04/12 17:14:45 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -23,7 +23,7 @@
* heap_fetch - retrive tuple with tid
* heap_insert - insert tuple into a relation
* heap_delete - delete a tuple from a relation
- * heap_update - replace a tuple in a relation with another tuple
+ * heap_update - replace a tuple in a relation with another tuple
* heap_markpos - mark scan position
* heap_restrpos - restore position to marked location
*
@@ -120,9 +120,9 @@ initscan(HeapScanDesc scan,
* ----------------
*/
scan->rs_ntup.t_datamcxt = scan->rs_ctup.t_datamcxt =
- scan->rs_ptup.t_datamcxt = NULL;
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ntup.t_data = scan->rs_ctup.t_data =
- scan->rs_ptup.t_data = NULL;
+ scan->rs_ptup.t_data = NULL;
scan->rs_nbuf = scan->rs_cbuf = scan->rs_pbuf = InvalidBuffer;
}
else if (atend)
@@ -188,8 +188,9 @@ unpinscan(HeapScanDesc scan)
if (BufferIsValid(scan->rs_nbuf))
ReleaseBuffer(scan->rs_nbuf);
- /* we don't bother to clear rs_pbuf etc --- caller must
- * reinitialize them if scan descriptor is not being deleted.
+ /*
+ * we don't bother to clear rs_pbuf etc --- caller must reinitialize
+ * them if scan descriptor is not being deleted.
*/
}
@@ -544,7 +545,7 @@ heap_open(Oid relationId, LOCKMODE lockmode)
if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */
- if (! RelationIsValid(r))
+ if (!RelationIsValid(r))
elog(ERROR, "Relation %u does not exist", relationId);
LockRelation(r, lockmode);
@@ -586,7 +587,7 @@ heap_openr(const char *relationName, LOCKMODE lockmode)
if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */
- if (! RelationIsValid(r))
+ if (!RelationIsValid(r))
elog(ERROR, "Relation '%s' does not exist", relationName);
LockRelation(r, lockmode);
@@ -646,7 +647,7 @@ heap_beginscan(Relation relation,
* sanity checks
* ----------------
*/
- if (! RelationIsValid(relation))
+ if (!RelationIsValid(relation))
elog(ERROR, "heap_beginscan: !RelationIsValid(relation)");
/* ----------------
@@ -659,7 +660,7 @@ heap_beginscan(Relation relation,
* Acquire AccessShareLock for the duration of the scan
*
* Note: we could get an SI inval message here and consequently have
- * to rebuild the relcache entry. The refcount increment above
+ * to rebuild the relcache entry. The refcount increment above
* ensures that we will rebuild it and not just flush it...
* ----------------
*/
@@ -681,6 +682,7 @@ heap_beginscan(Relation relation,
scan->rs_nkeys = (short) nkeys;
if (nkeys)
+
/*
* we do this here instead of in initscan() because heap_rescan
* also calls initscan() and we don't want to allocate memory
@@ -847,9 +849,7 @@ heap_getnext(HeapScanDesc scandesc, int backw)
if (scan->rs_ptup.t_data == scan->rs_ctup.t_data &&
BufferIsInvalid(scan->rs_pbuf))
- {
return NULL;
- }
/*
* Copy the "current" tuple/buffer to "next". Pin/unpin the
@@ -1095,8 +1095,10 @@ heap_fetch(Relation relation,
}
else
{
- /* All checks passed, so return the tuple as valid.
- * Caller is now responsible for releasing the buffer.
+
+ /*
+ * All checks passed, so return the tuple as valid. Caller is now
+ * responsible for releasing the buffer.
*/
*userbuf = buffer;
}
@@ -1109,17 +1111,18 @@ heap_fetch(Relation relation,
*/
ItemPointer
heap_get_latest_tid(Relation relation,
- Snapshot snapshot,
- ItemPointer tid)
+ Snapshot snapshot,
+ ItemPointer tid)
{
ItemId lp = NULL;
Buffer buffer;
PageHeader dp;
- OffsetNumber offnum;
- HeapTupleData tp;
- HeapTupleHeader t_data;
- ItemPointerData ctid;
- bool invalidBlock,linkend;
+ OffsetNumber offnum;
+ HeapTupleData tp;
+ HeapTupleHeader t_data;
+ ItemPointerData ctid;
+ bool invalidBlock,
+ linkend;
/* ----------------
* get the buffer from the relation descriptor
@@ -1149,11 +1152,11 @@ heap_get_latest_tid(Relation relation,
invalidBlock = false;
}
if (invalidBlock)
- {
+ {
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buffer);
return NULL;
- }
+ }
/* ----------------
* more sanity checks
@@ -1175,7 +1178,7 @@ heap_get_latest_tid(Relation relation,
snapshot, 0, (ScanKey) NULL);
linkend = true;
- if ((t_data->t_infomask & HEAP_XMAX_COMMITTED) &&
+ if ((t_data->t_infomask & HEAP_XMAX_COMMITTED) &&
!ItemPointerEquals(tid, &ctid))
linkend = false;
@@ -1186,7 +1189,7 @@ heap_get_latest_tid(Relation relation,
{
if (linkend)
return NULL;
- return heap_get_latest_tid(relation, snapshot, &ctid);
+ return heap_get_latest_tid(relation, snapshot, &ctid);
}
return tid;
@@ -1300,10 +1303,11 @@ l1:
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
if (TransactionIdDidAbort(xwait))
goto l1;
- /*
- * xwait is committed but if xwait had just marked
- * the tuple for update then some other xaction could
- * update this tuple before we got to this point.
+
+ /*
+ * xwait is committed but if xwait had just marked the tuple for
+ * update then some other xaction could update this tuple before
+ * we got to this point.
*/
if (tp.t_data->t_xmax != xwait)
goto l1;
@@ -1345,11 +1349,11 @@ l1:
}
/*
- * heap_update - replace a tuple
+ * heap_update - replace a tuple
*/
int
heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
- ItemPointer ctid)
+ ItemPointer ctid)
{
ItemId lp;
HeapTupleData oldtup;
@@ -1396,10 +1400,11 @@ l2:
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
if (TransactionIdDidAbort(xwait))
goto l2;
- /*
- * xwait is committed but if xwait had just marked
- * the tuple for update then some other xaction could
- * update this tuple before we got to this point.
+
+ /*
+ * xwait is committed but if xwait had just marked the tuple for
+ * update then some other xaction could update this tuple before
+ * we got to this point.
*/
if (oldtup.t_data->t_xmax != xwait)
goto l2;
@@ -1521,10 +1526,11 @@ l3:
LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE);
if (TransactionIdDidAbort(xwait))
goto l3;
- /*
- * xwait is committed but if xwait had just marked
- * the tuple for update then some other xaction could
- * update this tuple before we got to this point.
+
+ /*
+ * xwait is committed but if xwait had just marked the tuple for
+ * update then some other xaction could update this tuple before
+ * we got to this point.
*/
if (tuple->t_data->t_xmax != xwait)
goto l3;
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index b269ca90170..3fc2a69df1a 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Id: hio.c,v 1.30 2000/03/17 02:36:02 tgl Exp $
+ * $Id: hio.c,v 1.31 2000/04/12 17:14:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,7 +51,7 @@ RelationPutHeapTuple(Relation relation,
IncrHeapAccessStat(global_RelationPutHeapTuple);
pageHeader = (Page) BufferGetPage(buffer);
- len = MAXALIGN(tuple->t_len); /* be conservative */
+ len = MAXALIGN(tuple->t_len); /* be conservative */
Assert(len <= PageGetFreeSpace(pageHeader));
offnum = PageAddItem((Page) pageHeader, (Item) tuple->t_data,
@@ -108,11 +108,11 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
ItemId itemId;
Item item;
- len = MAXALIGN(tuple->t_len); /* be conservative */
+ len = MAXALIGN(tuple->t_len); /* be conservative */
/*
- * If we're gonna fail for oversize tuple, do it right away...
- * this code should go away eventually.
+ * If we're gonna fail for oversize tuple, do it right away... this
+ * code should go away eventually.
*/
if (len > MaxTupleSize)
elog(ERROR, "Tuple is too big: size %u, max size %ld",
@@ -136,8 +136,8 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
lastblock = RelationGetNumberOfBlocks(relation);
/*
- * Get the last existing page --- may need to create the first one
- * if this is a virgin relation.
+ * Get the last existing page --- may need to create the first one if
+ * this is a virgin relation.
*/
if (lastblock == 0)
{
@@ -168,12 +168,14 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
if (len > PageGetFreeSpace(pageHeader))
{
+
/*
- * BUG: by elog'ing here, we leave the new buffer locked and not
- * marked dirty, which may result in an invalid page header
- * being left on disk. But we should not get here given the
- * test at the top of the routine, and the whole deal should
- * go away when we implement tuple splitting anyway...
+ * BUG: by elog'ing here, we leave the new buffer locked and
+ * not marked dirty, which may result in an invalid page
+ * header being left on disk. But we should not get here
+ * given the test at the top of the routine, and the whole
+ * deal should go away when we implement tuple splitting
+ * anyway...
*/
elog(ERROR, "Tuple is too big: size %u", len);
}
diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c
index 9176521a5fc..3aadfb2cde0 100644
--- a/src/backend/access/heap/tuptoaster.c
+++ b/src/backend/access/heap/tuptoaster.c
@@ -2,13 +2,13 @@
*
* tuptoaster.c
* Support routines for external and compressed storage of
- * variable size attributes.
+ * variable size attributes.
*
* Copyright (c) 2000, PostgreSQL Global Development Group
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.2 2000/01/20 21:50:59 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.3 2000/04/12 17:14:45 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -30,17 +30,17 @@
#ifdef TUPLE_TOASTER_ACTIVE
void
-heap_tuple_toast_attrs (Relation rel, HeapTuple newtup, HeapTuple oldtup)
+heap_tuple_toast_attrs(Relation rel, HeapTuple newtup, HeapTuple oldtup)
{
return;
}
-varattrib *
-heap_tuple_untoast_attr (varattrib *attr)
+varattrib *
+heap_tuple_untoast_attr(varattrib * attr)
{
elog(ERROR, "heap_tuple_untoast_attr() called");
}
-#endif /* TUPLE_TOASTER_ACTIVE */
+#endif /* TUPLE_TOASTER_ACTIVE */