mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Ye-old pgindent run. Same 4-space tabs.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.61 2000/01/26 05:55:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12 17:14:36 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The old interface functions have been converted to macros
|
||||
@@ -137,9 +137,9 @@ DataFill(char *data,
|
||||
*((int32 *) value[i]));
|
||||
break;
|
||||
default:
|
||||
Assert(att[i]->attlen >= 0);
|
||||
memmove(data, DatumGetPointer(value[i]),
|
||||
(size_t)(att[i]->attlen));
|
||||
Assert(att[i]->attlen >= 0);
|
||||
memmove(data, DatumGetPointer(value[i]),
|
||||
(size_t) (att[i]->attlen));
|
||||
break;
|
||||
}
|
||||
data = (char *) att_addlength((long) data, att[i]->attlen, value[i]);
|
||||
@@ -326,7 +326,7 @@ nocachegetattr(HeapTuple tuple,
|
||||
Form_pg_attribute *att = tupleDesc->attrs;
|
||||
int slow = 0; /* do we have to walk nulls? */
|
||||
|
||||
(void)isnull; /*not used*/
|
||||
(void) isnull; /* not used */
|
||||
#ifdef IN_MACRO
|
||||
/* This is handled in the macro */
|
||||
Assert(attnum > 0);
|
||||
@@ -681,7 +681,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
|
||||
len += bitmaplen;
|
||||
}
|
||||
|
||||
hoff = len = MAXALIGN(len); /* be conservative here */
|
||||
hoff = len = MAXALIGN(len); /* be conservative here */
|
||||
|
||||
len += ComputeDataSize(tupleDescriptor, value, nulls);
|
||||
|
||||
@@ -806,11 +806,9 @@ void
|
||||
heap_freetuple(HeapTuple htup)
|
||||
{
|
||||
if (htup->t_data != NULL)
|
||||
if (htup->t_datamcxt != NULL && (char *)(htup->t_data) !=
|
||||
((char *) htup + HEAPTUPLESIZE))
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -835,7 +833,7 @@ heap_addheader(uint32 natts, /* max domain index */
|
||||
|
||||
len = offsetof(HeapTupleHeaderData, t_bits);
|
||||
|
||||
hoff = len = MAXALIGN(len); /* be conservative */
|
||||
hoff = len = MAXALIGN(len); /* be conservative */
|
||||
len += structlen;
|
||||
tuple = (HeapTuple) palloc(HEAPTUPLESIZE + len);
|
||||
tuple->t_datamcxt = CurrentMemoryContext;
|
||||
@@ -850,8 +848,8 @@ heap_addheader(uint32 natts, /* max domain index */
|
||||
td->t_infomask = 0;
|
||||
td->t_infomask |= HEAP_XMAX_INVALID;
|
||||
|
||||
if (structlen > 0)
|
||||
memmove((char *) td + hoff, structure, (size_t)structlen);
|
||||
if (structlen > 0)
|
||||
memmove((char *) td + hoff, structure, (size_t) structlen);
|
||||
|
||||
return tuple;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.42 2000/01/26 05:55:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.43 2000/04/12 17:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ index_formtuple(TupleDesc tupleDescriptor,
|
||||
|
||||
hoff = IndexInfoFindDataOffset(infomask);
|
||||
size = hoff + ComputeDataSize(tupleDescriptor, value, null);
|
||||
size = MAXALIGN(size); /* be conservative */
|
||||
size = MAXALIGN(size); /* be conservative */
|
||||
|
||||
tp = (char *) palloc(size);
|
||||
tuple = (IndexTuple) tp;
|
||||
@@ -134,7 +134,7 @@ nocache_index_getattr(IndexTuple tup,
|
||||
int data_off; /* tuple data offset */
|
||||
Form_pg_attribute *att = tupleDesc->attrs;
|
||||
|
||||
(void)isnull;
|
||||
(void) isnull;
|
||||
/* ----------------
|
||||
* sanity checks
|
||||
* ----------------
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.61 2000/01/31 04:35:48 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.62 2000/04/12 17:14:37 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* some of the executor utility code such as "ExecTypeFromTL" should be
|
||||
@@ -229,17 +229,19 @@ FreeTupleDesc(TupleDesc tupdesc)
|
||||
bool
|
||||
equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (tupdesc1->natts != tupdesc2->natts)
|
||||
return false;
|
||||
for (i = 0; i < tupdesc1->natts; i++)
|
||||
{
|
||||
Form_pg_attribute attr1 = tupdesc1->attrs[i];
|
||||
Form_pg_attribute attr2 = tupdesc2->attrs[i];
|
||||
Form_pg_attribute attr1 = tupdesc1->attrs[i];
|
||||
Form_pg_attribute attr2 = tupdesc2->attrs[i];
|
||||
|
||||
/* We do not need to check every single field here, and in fact
|
||||
* some fields such as attdisbursion probably shouldn't be compared.
|
||||
/*
|
||||
* We do not need to check every single field here, and in fact
|
||||
* some fields such as attdisbursion probably shouldn't be
|
||||
* compared.
|
||||
*/
|
||||
if (strcmp(NameStr(attr1->attname), NameStr(attr2->attname)) != 0)
|
||||
return false;
|
||||
@@ -254,8 +256,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
|
||||
}
|
||||
if (tupdesc1->constr != NULL)
|
||||
{
|
||||
TupleConstr *constr1 = tupdesc1->constr;
|
||||
TupleConstr *constr2 = tupdesc2->constr;
|
||||
TupleConstr *constr1 = tupdesc1->constr;
|
||||
TupleConstr *constr2 = tupdesc2->constr;
|
||||
|
||||
if (constr2 == NULL)
|
||||
return false;
|
||||
@@ -263,8 +265,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
|
||||
return false;
|
||||
for (i = 0; i < (int) constr1->num_defval; i++)
|
||||
{
|
||||
AttrDefault *defval1 = constr1->defval + i;
|
||||
AttrDefault *defval2 = constr2->defval + i;
|
||||
AttrDefault *defval1 = constr1->defval + i;
|
||||
AttrDefault *defval2 = constr2->defval + i;
|
||||
|
||||
if (defval1->adnum != defval2->adnum)
|
||||
return false;
|
||||
@@ -275,8 +277,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
|
||||
return false;
|
||||
for (i = 0; i < (int) constr1->num_check; i++)
|
||||
{
|
||||
ConstrCheck *check1 = constr1->check + i;
|
||||
ConstrCheck *check2 = constr2->check + i;
|
||||
ConstrCheck *check1 = constr1->check + i;
|
||||
ConstrCheck *check2 = constr2->check + i;
|
||||
|
||||
if (strcmp(check1->ccname, check2->ccname) != 0)
|
||||
return false;
|
||||
@@ -585,8 +587,9 @@ BuildDescForRelation(List *schema, char *relname)
|
||||
constr->has_not_null = true;
|
||||
desc->attrs[attnum - 1]->attnotnull = entry->is_not_null;
|
||||
|
||||
/* Note we copy only pre-cooked default expressions.
|
||||
* Digestion of raw ones is someone else's problem.
|
||||
/*
|
||||
* Note we copy only pre-cooked default expressions. Digestion of
|
||||
* raw ones is someone else's problem.
|
||||
*/
|
||||
if (entry->cooked_default != NULL)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.52 2000/03/17 02:36:00 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.53 2000/04/12 17:14:39 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -52,8 +52,10 @@ void gistdelete(Relation r, ItemPointer tid);
|
||||
static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t);
|
||||
static void gistcentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
|
||||
Relation r, Page pg, OffsetNumber o, int b, bool l);
|
||||
|
||||
#ifdef GISTDEBUG
|
||||
static char *int_range_out(INTRANGE *r);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -98,7 +100,7 @@ gistbuild(Relation heap,
|
||||
|
||||
/* no locking is needed */
|
||||
|
||||
CommandCounterIncrement(); /* so we can see the new pg_index tuple */
|
||||
CommandCounterIncrement(); /* so we can see the new pg_index tuple */
|
||||
|
||||
initGISTstate(&giststate, index);
|
||||
|
||||
@@ -186,7 +188,7 @@ gistbuild(Relation heap,
|
||||
#ifndef OMIT_PARTIAL_INDEX
|
||||
/* SetSlotContents(slot, htup); */
|
||||
slot->val = htup;
|
||||
if (! ExecQual((List *) pred, econtext, false))
|
||||
if (!ExecQual((List *) pred, econtext, false))
|
||||
continue;
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
}
|
||||
@@ -272,18 +274,18 @@ gistbuild(Relation heap,
|
||||
/*
|
||||
* Since we just counted the tuples in the heap, we update its stats
|
||||
* in pg_class to guarantee that the planner takes advantage of the
|
||||
* index we just created. But, only update statistics during
|
||||
* normal index definitions, not for indices on system catalogs
|
||||
* created during bootstrap processing. We must close the relations
|
||||
* before updating statistics to guarantee that the relcache entries
|
||||
* are flushed when we increment the command counter in UpdateStats().
|
||||
* But we do not release any locks on the relations; those will be
|
||||
* held until end of transaction.
|
||||
* index we just created. But, only update statistics during normal
|
||||
* index definitions, not for indices on system catalogs created
|
||||
* during bootstrap processing. We must close the relations before
|
||||
* updating statistics to guarantee that the relcache entries are
|
||||
* flushed when we increment the command counter in UpdateStats(). But
|
||||
* we do not release any locks on the relations; those will be held
|
||||
* until end of transaction.
|
||||
*/
|
||||
if (IsNormalProcessingMode())
|
||||
{
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
bool inplace = IsReindexProcessing();
|
||||
|
||||
heap_close(heap, NoLock);
|
||||
|
||||
@@ -266,7 +266,7 @@ gistdropscan(IndexScanDesc s)
|
||||
prev = l;
|
||||
|
||||
if (l == (GISTScanList) NULL)
|
||||
elog(ERROR, "GiST scan list corrupted -- cannot find 0x%p", (void*)s);
|
||||
elog(ERROR, "GiST scan list corrupted -- cannot find 0x%p", (void *) s);
|
||||
|
||||
if (prev == (GISTScanList) NULL)
|
||||
GISTScans = l->gsl_next;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.36 2000/03/01 05:39:22 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.37 2000/04/12 17:14:43 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
@@ -149,7 +149,7 @@ hashbuild(Relation heap,
|
||||
#ifndef OMIT_PARTIAL_INDEX
|
||||
/* SetSlotContents(slot, htup); */
|
||||
slot->val = htup;
|
||||
if (! ExecQual((List *) pred, econtext, false))
|
||||
if (!ExecQual((List *) pred, econtext, false))
|
||||
continue;
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
}
|
||||
@@ -230,18 +230,18 @@ hashbuild(Relation heap,
|
||||
/*
|
||||
* Since we just counted the tuples in the heap, we update its stats
|
||||
* in pg_class to guarantee that the planner takes advantage of the
|
||||
* index we just created. But, only update statistics during
|
||||
* normal index definitions, not for indices on system catalogs
|
||||
* created during bootstrap processing. We must close the relations
|
||||
* before updating statistics to guarantee that the relcache entries
|
||||
* are flushed when we increment the command counter in UpdateStats().
|
||||
* But we do not release any locks on the relations; those will be
|
||||
* held until end of transaction.
|
||||
* index we just created. But, only update statistics during normal
|
||||
* index definitions, not for indices on system catalogs created
|
||||
* during bootstrap processing. We must close the relations before
|
||||
* updating statistics to guarantee that the relcache entries are
|
||||
* flushed when we increment the command counter in UpdateStats(). But
|
||||
* we do not release any locks on the relations; those will be held
|
||||
* until end of transaction.
|
||||
*/
|
||||
if (IsNormalProcessingMode())
|
||||
{
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
bool inplace = IsReindexProcessing();
|
||||
|
||||
heap_close(heap, NoLock);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.24 2000/02/21 03:36:46 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.25 2000/04/12 17:14:44 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* These functions are stored in pg_amproc. For each operator class
|
||||
@@ -146,14 +146,14 @@ hashoidvector(Oid *key)
|
||||
int i;
|
||||
uint32 result = 0;
|
||||
|
||||
for (i = INDEX_MAX_KEYS; --i >= 0; )
|
||||
for (i = INDEX_MAX_KEYS; --i >= 0;)
|
||||
result = (result << 1) ^ (~(uint32) key[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: hashint2vector currently can't be used as a user hash table
|
||||
* hash function, because it has no pg_proc entry. We only need it
|
||||
* hash function, because it has no pg_proc entry. We only need it
|
||||
* for catcache indexing.
|
||||
*/
|
||||
uint32
|
||||
@@ -162,7 +162,7 @@ hashint2vector(int16 *key)
|
||||
int i;
|
||||
uint32 result = 0;
|
||||
|
||||
for (i = INDEX_MAX_KEYS; --i >= 0; )
|
||||
for (i = INDEX_MAX_KEYS; --i >= 0;)
|
||||
result = (result << 1) ^ (~(uint32) key[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.22 2000/01/26 05:55:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.23 2000/04/12 17:14:44 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Because we can be doing an index scan on a relation while we
|
||||
@@ -75,7 +75,7 @@ _hash_dropscan(IndexScanDesc scan)
|
||||
last = chk;
|
||||
|
||||
if (chk == (HashScanList) NULL)
|
||||
elog(ERROR, "hash scan list trashed; can't find 0x%p", (void*)scan);
|
||||
elog(ERROR, "hash scan list trashed; can't find 0x%p", (void *) scan);
|
||||
|
||||
if (last == (HashScanList) NULL)
|
||||
HashScans = chk->hashsl_next;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.23 2000/03/17 02:36:02 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.24 2000/04/12 17:14:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -351,7 +351,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
|
||||
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
|
||||
Assert(opaque->hasho_bucket == bucket);
|
||||
while (PageIsEmpty(page) &&
|
||||
BlockNumberIsValid(opaque->hasho_nextblkno))
|
||||
BlockNumberIsValid(opaque->hasho_nextblkno))
|
||||
_hash_readnext(rel, &buf, &page, &opaque);
|
||||
maxoff = PageGetMaxOffsetNumber(page);
|
||||
offnum = FirstOffsetNumber;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.24 2000/03/14 23:52:01 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.25 2000/04/12 17:14:47 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* many of the old access method routines have been turned into
|
||||
@@ -62,7 +62,7 @@
|
||||
*
|
||||
* At the end of a scan, the AM's endscan routine undoes the locking,
|
||||
* but does *not* call IndexScanEnd --- the higher-level index_endscan
|
||||
* routine does that. (We can't do it in the AM because index_endscan
|
||||
* routine does that. (We can't do it in the AM because index_endscan
|
||||
* still needs to touch the IndexScanDesc after calling the AM.)
|
||||
*
|
||||
* Because of this, the AM does not have a choice whether to call
|
||||
@@ -114,7 +114,10 @@ RelationGetIndexScan(Relation relation,
|
||||
ItemPointerSetInvalid(&scan->currentMarkData);
|
||||
ItemPointerSetInvalid(&scan->nextMarkData);
|
||||
|
||||
/* mark cached function lookup data invalid; it will be set on first use */
|
||||
/*
|
||||
* mark cached function lookup data invalid; it will be set on first
|
||||
* use
|
||||
*/
|
||||
scan->fn_getnext.fn_oid = InvalidOid;
|
||||
|
||||
if (numberOfKeys > 0)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.41 2000/03/14 23:52:01 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.42 2000/04/12 17:14:47 momjian Exp $
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
* index_open - open an index relation by relationId
|
||||
@@ -115,10 +115,10 @@
|
||||
* index_open - open an index relation by relationId
|
||||
*
|
||||
* presently the relcache routines do all the work we need
|
||||
* to open/close index relations. However, callers of index_open
|
||||
* to open/close index relations. However, callers of index_open
|
||||
* expect it to succeed, so we need to check for a failure return.
|
||||
*
|
||||
* Note: we acquire no lock on the index. An AccessShareLock is
|
||||
* Note: we acquire no lock on the index. An AccessShareLock is
|
||||
* acquired by index_beginscan (and released by index_endscan).
|
||||
* ----------------
|
||||
*/
|
||||
@@ -129,7 +129,7 @@ index_open(Oid relationId)
|
||||
|
||||
r = RelationIdGetRelation(relationId);
|
||||
|
||||
if (! RelationIsValid(r))
|
||||
if (!RelationIsValid(r))
|
||||
elog(ERROR, "Index %u does not exist", relationId);
|
||||
|
||||
if (r->rd_rel->relkind != RELKIND_INDEX)
|
||||
@@ -151,7 +151,7 @@ index_openr(char *relationName)
|
||||
|
||||
r = RelationNameGetRelation(relationName);
|
||||
|
||||
if (! RelationIsValid(r))
|
||||
if (!RelationIsValid(r))
|
||||
elog(ERROR, "Index '%s' does not exist", relationName);
|
||||
|
||||
if (r->rd_rel->relkind != RELKIND_INDEX)
|
||||
@@ -238,7 +238,7 @@ index_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...
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.41 2000/02/18 09:29:16 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.42 2000/04/12 17:14:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -477,7 +477,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
|
||||
{
|
||||
HeapTuple tuple;
|
||||
HeapScanDesc scan = NULL;
|
||||
bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized();
|
||||
bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized();
|
||||
|
||||
if (cachesearch)
|
||||
{
|
||||
@@ -547,7 +547,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
AttrNumber attributeNumber;
|
||||
int attributeIndex;
|
||||
Oid operatorClassObjectId[INDEX_MAX_KEYS];
|
||||
bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized();
|
||||
bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized();
|
||||
|
||||
if (cachesearch)
|
||||
{
|
||||
@@ -674,7 +674,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
aform = (Form_pg_amop) GETSTRUCT(tuple);
|
||||
OperatorRelationFillScanKeyEntry(operatorRelation,
|
||||
aform->amopopr,
|
||||
StrategyMapGetScanKeyEntry(map, aform->amopstrategy));
|
||||
StrategyMapGetScanKeyEntry(map, aform->amopstrategy));
|
||||
}
|
||||
|
||||
heap_endscan(scan);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.33 2000/02/10 19:51:38 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.34 2000/04/12 17:14:49 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* These functions are stored in pg_amproc. For each operator class
|
||||
@@ -35,12 +35,12 @@ btint2cmp(int16 a, int16 b)
|
||||
int32
|
||||
btint4cmp(int32 a, int32 b)
|
||||
{
|
||||
if (a > b)
|
||||
return 1;
|
||||
else if (a == b)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
if (a > b)
|
||||
return 1;
|
||||
else if (a == b)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.56 2000/03/17 02:36:03 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.57 2000/04/12 17:14:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
static InsertIndexResult _bt_insertonpg(Relation rel, Buffer buf, BTStack stack, int keysz, ScanKey scankey, BTItem btitem, BTItem afteritem);
|
||||
static Buffer _bt_split(Relation rel, Size keysz, ScanKey scankey,
|
||||
Buffer buf, OffsetNumber firstright);
|
||||
Buffer buf, OffsetNumber firstright);
|
||||
static OffsetNumber _bt_findsplitloc(Relation rel, Size keysz, ScanKey scankey,
|
||||
Page page, OffsetNumber start,
|
||||
OffsetNumber maxoff, Size llimit);
|
||||
Page page, OffsetNumber start,
|
||||
OffsetNumber maxoff, Size llimit);
|
||||
static void _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf);
|
||||
static OffsetNumber _bt_pgaddtup(Relation rel, Buffer buf, int keysz, ScanKey itup_scankey, Size itemsize, BTItem btitem, BTItem afteritem);
|
||||
static bool _bt_goesonpg(Relation rel, Buffer buf, Size keysz, ScanKey scankey, BTItem afteritem);
|
||||
@@ -267,21 +267,20 @@ _bt_insertonpg(Relation rel,
|
||||
itemsz = IndexTupleDSize(btitem->bti_itup)
|
||||
+ (sizeof(BTItemData) - sizeof(IndexTupleData));
|
||||
|
||||
itemsz = MAXALIGN(itemsz); /* be safe, PageAddItem will do
|
||||
* this but we need to be
|
||||
* consistent */
|
||||
itemsz = MAXALIGN(itemsz); /* be safe, PageAddItem will do this but
|
||||
* we need to be consistent */
|
||||
|
||||
/*
|
||||
* Check whether the item can fit on a btree page at all.
|
||||
* (Eventually, we ought to try to apply TOAST methods if not.)
|
||||
* We actually need to be able to fit three items on every page,
|
||||
* so restrict any one item to 1/3 the per-page available space.
|
||||
* Note that at this point, itemsz doesn't include the ItemId.
|
||||
* Check whether the item can fit on a btree page at all. (Eventually,
|
||||
* we ought to try to apply TOAST methods if not.) We actually need to
|
||||
* be able to fit three items on every page, so restrict any one item
|
||||
* to 1/3 the per-page available space. Note that at this point,
|
||||
* itemsz doesn't include the ItemId.
|
||||
*/
|
||||
if (itemsz > (PageGetPageSize(page)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData))
|
||||
if (itemsz > (PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
|
||||
elog(ERROR, "btree: index item size %u exceeds maximum %lu",
|
||||
itemsz,
|
||||
(PageGetPageSize(page)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData));
|
||||
(PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
|
||||
|
||||
/*
|
||||
* If we have to insert item on the leftmost page which is the first
|
||||
@@ -415,8 +414,8 @@ _bt_insertonpg(Relation rel,
|
||||
bool is_root = lpageop->btpo_flags & BTP_ROOT;
|
||||
|
||||
/*
|
||||
* Instead of splitting leaf page in the chain of duplicates
|
||||
* by new duplicate, insert it into some right page.
|
||||
* Instead of splitting leaf page in the chain of duplicates by
|
||||
* new duplicate, insert it into some right page.
|
||||
*/
|
||||
if ((lpageop->btpo_flags & BTP_CHAIN) &&
|
||||
(lpageop->btpo_flags & BTP_LEAF) && keys_equal)
|
||||
@@ -424,8 +423,9 @@ _bt_insertonpg(Relation rel,
|
||||
rbuf = _bt_getbuf(rel, lpageop->btpo_next, BT_WRITE);
|
||||
rpage = BufferGetPage(rbuf);
|
||||
rpageop = (BTPageOpaque) PageGetSpecialPointer(rpage);
|
||||
/*
|
||||
* some checks
|
||||
|
||||
/*
|
||||
* some checks
|
||||
*/
|
||||
if (!P_RIGHTMOST(rpageop)) /* non-rightmost page */
|
||||
{ /* If we have the same hikey here then
|
||||
@@ -442,6 +442,7 @@ _bt_insertonpg(Relation rel,
|
||||
BTGreaterStrategyNumber))
|
||||
elog(FATAL, "btree: hikey is out of order");
|
||||
else if (rpageop->btpo_flags & BTP_CHAIN)
|
||||
|
||||
/*
|
||||
* If hikey > scankey then it's last page in chain and
|
||||
* BTP_CHAIN must be OFF
|
||||
@@ -450,9 +451,7 @@ _bt_insertonpg(Relation rel,
|
||||
}
|
||||
else
|
||||
/* rightmost page */
|
||||
{
|
||||
Assert(!(rpageop->btpo_flags & BTP_CHAIN));
|
||||
}
|
||||
_bt_relbuf(rel, buf, BT_WRITE);
|
||||
return (_bt_insertonpg(rel, rbuf, stack, keysz,
|
||||
scankey, btitem, afteritem));
|
||||
@@ -708,7 +707,7 @@ l_spl: ;
|
||||
*/
|
||||
if (!parent_chained &&
|
||||
MAXALIGN(IndexTupleDSize(lowLeftItem->bti_itup)) ==
|
||||
MAXALIGN(IndexTupleDSize(stack->bts_btitem->bti_itup)))
|
||||
MAXALIGN(IndexTupleDSize(stack->bts_btitem->bti_itup)))
|
||||
{
|
||||
_bt_updateitem(rel, keysz, pbuf,
|
||||
stack->bts_btitem, lowLeftItem);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.35 2000/01/26 05:55:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.36 2000/04/12 17:14:49 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Postgres btree pages look like ordinary relation pages. The opaque
|
||||
@@ -257,7 +257,7 @@ _bt_getroot(Relation rel, int access)
|
||||
else
|
||||
{
|
||||
rootblkno = metad->btm_root;
|
||||
_bt_relbuf(rel, metabuf, BT_READ); /* done with the meta page */
|
||||
_bt_relbuf(rel, metabuf, BT_READ); /* done with the meta page */
|
||||
|
||||
rootbuf = _bt_getbuf(rel, rootblkno, access);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.53 2000/02/18 09:29:54 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.54 2000/04/12 17:14:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ btbuild(Relation heap,
|
||||
#endif
|
||||
Node *pred,
|
||||
*oldPred;
|
||||
BTSpool *spool = NULL;
|
||||
BTSpool *spool = NULL;
|
||||
bool isunique;
|
||||
bool usefast;
|
||||
|
||||
@@ -185,7 +185,7 @@ btbuild(Relation heap,
|
||||
#ifndef OMIT_PARTIAL_INDEX
|
||||
/* SetSlotContents(slot, htup); */
|
||||
slot->val = htup;
|
||||
if (! ExecQual((List *) pred, econtext, false))
|
||||
if (!ExecQual((List *) pred, econtext, false))
|
||||
continue;
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
}
|
||||
@@ -276,9 +276,9 @@ btbuild(Relation heap,
|
||||
}
|
||||
|
||||
/*
|
||||
* if we are doing bottom-up btree build, finish the build by
|
||||
* (1) completing the sort of the spool file, (2) inserting the
|
||||
* sorted tuples into btree pages and (3) building the upper levels.
|
||||
* if we are doing bottom-up btree build, finish the build by (1)
|
||||
* completing the sort of the spool file, (2) inserting the sorted
|
||||
* tuples into btree pages and (3) building the upper levels.
|
||||
*/
|
||||
if (usefast)
|
||||
{
|
||||
@@ -298,26 +298,27 @@ btbuild(Relation heap,
|
||||
/*
|
||||
* Since we just counted the tuples in the heap, we update its stats
|
||||
* in pg_class to guarantee that the planner takes advantage of the
|
||||
* index we just created. But, only update statistics during
|
||||
* normal index definitions, not for indices on system catalogs
|
||||
* created during bootstrap processing. We must close the relations
|
||||
* before updating statistics to guarantee that the relcache entries
|
||||
* are flushed when we increment the command counter in UpdateStats().
|
||||
* But we do not release any locks on the relations; those will be
|
||||
* held until end of transaction.
|
||||
* index we just created. But, only update statistics during normal
|
||||
* index definitions, not for indices on system catalogs created
|
||||
* during bootstrap processing. We must close the relations before
|
||||
* updating statistics to guarantee that the relcache entries are
|
||||
* flushed when we increment the command counter in UpdateStats(). But
|
||||
* we do not release any locks on the relations; those will be held
|
||||
* until end of transaction.
|
||||
*/
|
||||
if (IsNormalProcessingMode())
|
||||
{
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
bool inplace = IsReindexProcessing();
|
||||
|
||||
heap_close(heap, NoLock);
|
||||
index_close(index);
|
||||
|
||||
/*
|
||||
UpdateStats(hrelid, nhtups, true);
|
||||
UpdateStats(irelid, nitups, false);
|
||||
*/
|
||||
* UpdateStats(hrelid, nhtups, true); UpdateStats(irelid, nitups,
|
||||
* false);
|
||||
*/
|
||||
UpdateStats(hrelid, nhtups, inplace);
|
||||
UpdateStats(irelid, nitups, inplace);
|
||||
if (oldPred != NULL)
|
||||
@@ -623,7 +624,7 @@ _bt_restscan(IndexScanDesc scan)
|
||||
BTItem item;
|
||||
BlockNumber blkno;
|
||||
|
||||
LockBuffer(buf, BT_READ); /* lock buffer first! */
|
||||
LockBuffer(buf, BT_READ); /* lock buffer first! */
|
||||
page = BufferGetPage(buf);
|
||||
maxoff = PageGetMaxOffsetNumber(page);
|
||||
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.30 2000/01/26 05:55:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.31 2000/04/12 17:14:49 momjian Exp $
|
||||
*
|
||||
*
|
||||
* NOTES
|
||||
@@ -52,13 +52,16 @@ static void _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offn
|
||||
void
|
||||
AtEOXact_nbtree(void)
|
||||
{
|
||||
/* Note: these actions should only be necessary during xact abort;
|
||||
* but they can't hurt during a commit.
|
||||
|
||||
/*
|
||||
* Note: these actions should only be necessary during xact abort; but
|
||||
* they can't hurt during a commit.
|
||||
*/
|
||||
|
||||
/* Reset the active-scans list to empty.
|
||||
* We do not need to free the list elements, because they're all
|
||||
* palloc()'d, so they'll go away at end of transaction anyway.
|
||||
/*
|
||||
* Reset the active-scans list to empty. We do not need to free the
|
||||
* list elements, because they're all palloc()'d, so they'll go away
|
||||
* at end of transaction anyway.
|
||||
*/
|
||||
BTScans = NULL;
|
||||
|
||||
@@ -96,7 +99,7 @@ _bt_dropscan(IndexScanDesc scan)
|
||||
last = chk;
|
||||
|
||||
if (chk == (BTScanList) NULL)
|
||||
elog(ERROR, "btree scan list trashed; can't find 0x%p", (void*)scan);
|
||||
elog(ERROR, "btree scan list trashed; can't find 0x%p", (void *) scan);
|
||||
|
||||
if (last == (BTScanList) NULL)
|
||||
BTScans = chk->btsl_next;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.58 2000/03/17 02:36:04 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.59 2000/04/12 17:14:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -299,9 +299,7 @@ _bt_skeycmp(Relation rel,
|
||||
compare = -1; /* not-NULL key "<" NULL datum */
|
||||
}
|
||||
else
|
||||
{
|
||||
compare = (int32) FMGR_PTR2(&entry->sk_func, keyDatum, attrDatum);
|
||||
}
|
||||
|
||||
if (compare != 0)
|
||||
break; /* done when we find unequal attributes */
|
||||
@@ -368,26 +366,26 @@ _bt_binsrch(Relation rel,
|
||||
|
||||
/*
|
||||
* If there are no keys on the page, return the first available slot.
|
||||
* Note this covers two cases: the page is really empty (no keys),
|
||||
* or it contains only a high key. The latter case is possible after
|
||||
* Note this covers two cases: the page is really empty (no keys), or
|
||||
* it contains only a high key. The latter case is possible after
|
||||
* vacuuming.
|
||||
*/
|
||||
if (high < low)
|
||||
return low;
|
||||
|
||||
/*
|
||||
* Binary search to find the first key on the page >= scan key.
|
||||
* Loop invariant: all slots before 'low' are < scan key, all slots
|
||||
* at or after 'high' are >= scan key. Also, haveEq is true if the
|
||||
* tuple at 'high' is == scan key.
|
||||
* We can fall out when high == low.
|
||||
* Binary search to find the first key on the page >= scan key. Loop
|
||||
* invariant: all slots before 'low' are < scan key, all slots at or
|
||||
* after 'high' are >= scan key. Also, haveEq is true if the tuple at
|
||||
* 'high' is == scan key. We can fall out when high == low.
|
||||
*/
|
||||
high++; /* establish the loop invariant for high */
|
||||
haveEq = false;
|
||||
|
||||
while (high > low)
|
||||
{
|
||||
OffsetNumber mid = low + ((high - low) / 2);
|
||||
OffsetNumber mid = low + ((high - low) / 2);
|
||||
|
||||
/* We have low <= mid < high, so mid points at a real slot */
|
||||
|
||||
result = _bt_compare(rel, itupdesc, page, keysz, scankey, mid);
|
||||
@@ -403,7 +401,7 @@ _bt_binsrch(Relation rel,
|
||||
|
||||
/*--------------------
|
||||
* At this point we have high == low, but be careful: they could point
|
||||
* past the last slot on the page. We also know that haveEq is true
|
||||
* past the last slot on the page. We also know that haveEq is true
|
||||
* if and only if there is an equal key (in which case high&low point
|
||||
* at the first equal key).
|
||||
*
|
||||
@@ -443,18 +441,20 @@ _bt_binsrch(Relation rel,
|
||||
|
||||
if (haveEq)
|
||||
{
|
||||
|
||||
/*
|
||||
* There is an equal key. We return either the first equal key
|
||||
* (which we just found), or the last lesser key.
|
||||
*
|
||||
* We need not check srchtype != BT_DESCENT here, since if that
|
||||
* is true then natts == keysz by assumption.
|
||||
* We need not check srchtype != BT_DESCENT here, since if that is
|
||||
* true then natts == keysz by assumption.
|
||||
*/
|
||||
if (natts == keysz)
|
||||
return low; /* return first equal key */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* There is no equal key. We return either the first greater key
|
||||
* (which we just found), or the last lesser key.
|
||||
@@ -524,6 +524,7 @@ _bt_compare(Relation rel,
|
||||
&& P_LEFTMOST(opaque)
|
||||
&& offnum == P_HIKEY)
|
||||
{
|
||||
|
||||
/*
|
||||
* we just have to believe that this will only be called with
|
||||
* offnum == P_HIKEY when P_HIKEY is the OffsetNumber of the first
|
||||
@@ -702,11 +703,12 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
|
||||
bool strategyCheck;
|
||||
ScanKey scankeys = 0;
|
||||
int keysCount = 0;
|
||||
int *nKeyIs = 0;
|
||||
int i, j;
|
||||
StrategyNumber strat_total;
|
||||
|
||||
int keysCount = 0;
|
||||
int *nKeyIs = 0;
|
||||
int i,
|
||||
j;
|
||||
StrategyNumber strat_total;
|
||||
|
||||
rel = scan->relation;
|
||||
so = (BTScanOpaque) scan->opaque;
|
||||
|
||||
@@ -723,15 +725,15 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
_bt_orderkeys(rel, so);
|
||||
|
||||
if (so->qual_ok)
|
||||
strategyCheck = true;
|
||||
}
|
||||
strategyCheck = true;
|
||||
}
|
||||
strat_total = BTEqualStrategyNumber;
|
||||
if (strategyCheck)
|
||||
{
|
||||
AttrNumber attno;
|
||||
|
||||
nKeyIs = (int *)palloc(so->numberOfKeys*sizeof(int));
|
||||
for (i=0; i < so->numberOfKeys; i++)
|
||||
nKeyIs = (int *) palloc(so->numberOfKeys * sizeof(int));
|
||||
for (i = 0; i < so->numberOfKeys; i++)
|
||||
{
|
||||
attno = so->keyData[i].sk_attno;
|
||||
if (attno == keysCount)
|
||||
@@ -739,16 +741,16 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
if (attno > keysCount + 1)
|
||||
break;
|
||||
strat = _bt_getstrat(rel, attno,
|
||||
so->keyData[i].sk_procedure);
|
||||
so->keyData[i].sk_procedure);
|
||||
if (strat == strat_total ||
|
||||
strat == BTEqualStrategyNumber)
|
||||
strat == BTEqualStrategyNumber)
|
||||
{
|
||||
nKeyIs[keysCount++] = i;
|
||||
continue;
|
||||
}
|
||||
if (ScanDirectionIsBackward(dir) &&
|
||||
(strat == BTLessStrategyNumber ||
|
||||
strat == BTLessEqualStrategyNumber) )
|
||||
(strat == BTLessStrategyNumber ||
|
||||
strat == BTLessEqualStrategyNumber))
|
||||
{
|
||||
nKeyIs[keysCount++] = i;
|
||||
strat_total = strat;
|
||||
@@ -757,8 +759,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
continue;
|
||||
}
|
||||
if (ScanDirectionIsForward(dir) &&
|
||||
(strat == BTGreaterStrategyNumber ||
|
||||
strat == BTGreaterEqualStrategyNumber) )
|
||||
(strat == BTGreaterStrategyNumber ||
|
||||
strat == BTGreaterEqualStrategyNumber))
|
||||
{
|
||||
nKeyIs[keysCount++] = i;
|
||||
strat_total = strat;
|
||||
@@ -794,8 +796,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
* at the right place in the scan.
|
||||
*/
|
||||
/* _bt_orderkeys disallows it, but it's place to add some code latter */
|
||||
scankeys = (ScanKey)palloc(keysCount*sizeof(ScanKeyData));
|
||||
for (i=0; i < keysCount; i++)
|
||||
scankeys = (ScanKey) palloc(keysCount * sizeof(ScanKeyData));
|
||||
for (i = 0; i < keysCount; i++)
|
||||
{
|
||||
j = nKeyIs[i];
|
||||
if (so->keyData[j].sk_flags & SK_ISNULL)
|
||||
@@ -804,12 +806,13 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
pfree(scankeys);
|
||||
elog(ERROR, "_bt_first: btree doesn't support is(not)null, yet");
|
||||
return ((RetrieveIndexResult) NULL);
|
||||
}
|
||||
proc = index_getprocid(rel, i+1, BTORDER_PROC);
|
||||
ScanKeyEntryInitialize(scankeys+i, so->keyData[j].sk_flags,
|
||||
i+1, proc, so->keyData[j].sk_argument);
|
||||
}
|
||||
proc = index_getprocid(rel, i + 1, BTORDER_PROC);
|
||||
ScanKeyEntryInitialize(scankeys + i, so->keyData[j].sk_flags,
|
||||
i + 1, proc, so->keyData[j].sk_argument);
|
||||
}
|
||||
if (nKeyIs) pfree(nKeyIs);
|
||||
if (nKeyIs)
|
||||
pfree(nKeyIs);
|
||||
|
||||
stack = _bt_search(rel, keysCount, scankeys, &buf);
|
||||
_bt_freestack(stack);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* We use tuplesort.c to sort the given index tuples into order.
|
||||
* Then we scan the index tuples in order and build the btree pages
|
||||
* for each level. When we have only one page on a level, it must be the
|
||||
* for each level. When we have only one page on a level, it must be the
|
||||
* root -- it can be attached to the btree metapage and we are done.
|
||||
*
|
||||
* this code is moderately slow (~10% slower) compared to the regular
|
||||
@@ -28,7 +28,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.51 2000/02/18 06:32:39 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.52 2000/04/12 17:14:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -70,12 +70,12 @@ struct BTSpool
|
||||
|
||||
static void _bt_load(Relation index, BTSpool *btspool);
|
||||
static BTItem _bt_buildadd(Relation index, Size keysz, ScanKey scankey,
|
||||
BTPageState *state, BTItem bti, int flags);
|
||||
BTPageState *state, BTItem bti, int flags);
|
||||
static BTItem _bt_minitem(Page opage, BlockNumber oblkno, int atend);
|
||||
static BTPageState *_bt_pagestate(Relation index, int flags,
|
||||
int level, bool doupper);
|
||||
int level, bool doupper);
|
||||
static void _bt_uppershutdown(Relation index, Size keysz, ScanKey scankey,
|
||||
BTPageState *state);
|
||||
BTPageState *state);
|
||||
|
||||
|
||||
/*
|
||||
@@ -86,7 +86,7 @@ static void _bt_uppershutdown(Relation index, Size keysz, ScanKey scankey,
|
||||
/*
|
||||
* create and initialize a spool structure
|
||||
*/
|
||||
BTSpool *
|
||||
BTSpool *
|
||||
_bt_spoolinit(Relation index, bool isunique)
|
||||
{
|
||||
BTSpool *btspool = (BTSpool *) palloc(sizeof(BTSpool));
|
||||
@@ -99,9 +99,9 @@ _bt_spoolinit(Relation index, bool isunique)
|
||||
btspool->sortstate = tuplesort_begin_index(index, isunique, false);
|
||||
|
||||
/*
|
||||
* Currently, tuplesort provides sort functions on IndexTuples.
|
||||
* If we kept anything in a BTItem other than a regular IndexTuple,
|
||||
* we'd need to modify tuplesort to understand BTItems as such.
|
||||
* Currently, tuplesort provides sort functions on IndexTuples. If we
|
||||
* kept anything in a BTItem other than a regular IndexTuple, we'd
|
||||
* need to modify tuplesort to understand BTItems as such.
|
||||
*/
|
||||
Assert(sizeof(BTItemData) == sizeof(IndexTupleData));
|
||||
|
||||
@@ -306,20 +306,20 @@ _bt_buildadd(Relation index, Size keysz, ScanKey scankey,
|
||||
btisz = MAXALIGN(btisz);
|
||||
|
||||
/*
|
||||
* Check whether the item can fit on a btree page at all.
|
||||
* (Eventually, we ought to try to apply TOAST methods if not.)
|
||||
* We actually need to be able to fit three items on every page,
|
||||
* so restrict any one item to 1/3 the per-page available space.
|
||||
* Note that at this point, btisz doesn't include the ItemId.
|
||||
* Check whether the item can fit on a btree page at all. (Eventually,
|
||||
* we ought to try to apply TOAST methods if not.) We actually need to
|
||||
* be able to fit three items on every page, so restrict any one item
|
||||
* to 1/3 the per-page available space. Note that at this point, btisz
|
||||
* doesn't include the ItemId.
|
||||
*
|
||||
* NOTE: similar code appears in _bt_insertonpg() to defend against
|
||||
* oversize items being inserted into an already-existing index.
|
||||
* But during creation of an index, we don't go through there.
|
||||
* oversize items being inserted into an already-existing index. But
|
||||
* during creation of an index, we don't go through there.
|
||||
*/
|
||||
if (btisz > (PageGetPageSize(npage)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData))
|
||||
if (btisz > (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
|
||||
elog(ERROR, "btree: index item size %d exceeds maximum %ld",
|
||||
btisz,
|
||||
(PageGetPageSize(npage)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData));
|
||||
(PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
|
||||
|
||||
if (pgspc < btisz)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.35 2000/02/18 06:32:39 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.36 2000/04/12 17:14:50 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -141,7 +141,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
|
||||
uint16 numberOfKeys = so->numberOfKeys;
|
||||
uint16 new_numberOfKeys = 0;
|
||||
AttrNumber attno = 1;
|
||||
bool equalStrategyEnd, underEqualStrategy;
|
||||
bool equalStrategyEnd,
|
||||
underEqualStrategy;
|
||||
|
||||
if (numberOfKeys < 1)
|
||||
return;
|
||||
@@ -194,6 +195,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
|
||||
elog(ERROR, "_bt_orderkeys: key(s) for attribute %d missed", attno + 1);
|
||||
|
||||
underEqualStrategy = (!equalStrategyEnd);
|
||||
|
||||
/*
|
||||
* If = has been specified, no other key will be used. In case
|
||||
* of key < 2 && key == 1 and so on we have to set qual_ok to
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.44 2000/03/01 05:39:23 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.45 2000/04/12 17:14:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -181,7 +181,7 @@ rtbuild(Relation heap,
|
||||
#ifndef OMIT_PARTIAL_INDEX
|
||||
/* SetSlotContents(slot, htup); */
|
||||
slot->val = htup;
|
||||
if (! ExecQual((List *) pred, econtext, false))
|
||||
if (!ExecQual((List *) pred, econtext, false))
|
||||
continue;
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
}
|
||||
@@ -249,18 +249,18 @@ rtbuild(Relation heap,
|
||||
/*
|
||||
* Since we just counted the tuples in the heap, we update its stats
|
||||
* in pg_class to guarantee that the planner takes advantage of the
|
||||
* index we just created. But, only update statistics during
|
||||
* normal index definitions, not for indices on system catalogs
|
||||
* created during bootstrap processing. We must close the relations
|
||||
* before updating statistics to guarantee that the relcache entries
|
||||
* are flushed when we increment the command counter in UpdateStats().
|
||||
* But we do not release any locks on the relations; those will be
|
||||
* held until end of transaction.
|
||||
* index we just created. But, only update statistics during normal
|
||||
* index definitions, not for indices on system catalogs created
|
||||
* during bootstrap processing. We must close the relations before
|
||||
* updating statistics to guarantee that the relcache entries are
|
||||
* flushed when we increment the command counter in UpdateStats(). But
|
||||
* we do not release any locks on the relations; those will be held
|
||||
* until end of transaction.
|
||||
*/
|
||||
if (IsNormalProcessingMode())
|
||||
{
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
bool inplace = IsReindexProcessing();
|
||||
|
||||
heap_close(heap, NoLock);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.31 2000/01/26 05:56:00 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.32 2000/04/12 17:14:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -268,7 +268,7 @@ rtdropscan(IndexScanDesc s)
|
||||
prev = l;
|
||||
|
||||
if (l == (RTScanList) NULL)
|
||||
elog(ERROR, "rtree scan list corrupted -- cannot find 0x%p", (void*)s);
|
||||
elog(ERROR, "rtree scan list corrupted -- cannot find 0x%p", (void *) s);
|
||||
|
||||
if (prev == (RTScanList) NULL)
|
||||
RTScans = l->rtsl_next;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "postgres.h"
|
||||
#include "access/rmgr.h"
|
||||
|
||||
RmgrData *RmgrTable = NULL;
|
||||
RmgrData *RmgrTable = NULL;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.33 2000/01/26 05:56:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.34 2000/04/12 17:14:52 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains the high level access-method interface to the
|
||||
@@ -162,6 +162,7 @@ TransactionLogTest(TransactionId transactionId, /* transaction id to test */
|
||||
|
||||
if (!fail)
|
||||
{
|
||||
|
||||
/*
|
||||
* DO NOT cache status for transactions in unknown state !!!
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.27 2000/03/31 02:43:31 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.28 2000/04/12 17:14:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -331,8 +331,8 @@ ReadNewTransactionId(TransactionId *xid)
|
||||
SpinAcquire(OidGenLockId); /* not good for concurrency... */
|
||||
|
||||
/*
|
||||
* Note that we don't check is ShmemVariableCache->xid_count equal
|
||||
* to 0 or not. This will work as long as we don't call
|
||||
* Note that we don't check is ShmemVariableCache->xid_count equal to
|
||||
* 0 or not. This will work as long as we don't call
|
||||
* ReadNewTransactionId() before GetNewTransactionId().
|
||||
*/
|
||||
if (ShmemVariableCache->nextXid == 0)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.63 2000/04/09 04:43:16 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.64 2000/04/12 17:14:53 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Transaction aborts can now occur two ways:
|
||||
@@ -160,7 +160,7 @@
|
||||
#include "utils/portal.h"
|
||||
#include "utils/relcache.h"
|
||||
|
||||
extern bool SharedBufferChanged;
|
||||
extern bool SharedBufferChanged;
|
||||
|
||||
static void AbortTransaction(void);
|
||||
static void AtAbort_Cache(void);
|
||||
@@ -517,8 +517,8 @@ CommandCounterIncrement()
|
||||
CurrentTransactionStateData.scanCommandId = CurrentTransactionStateData.commandId;
|
||||
|
||||
/*
|
||||
* make cache changes visible to me. AtCommit_LocalCache()
|
||||
* instead of AtCommit_Cache() is called here.
|
||||
* make cache changes visible to me. AtCommit_LocalCache() instead of
|
||||
* AtCommit_Cache() is called here.
|
||||
*/
|
||||
AtCommit_LocalCache();
|
||||
AtStart_Cache();
|
||||
@@ -627,16 +627,15 @@ RecordTransactionCommit()
|
||||
*/
|
||||
xid = GetCurrentTransactionId();
|
||||
|
||||
/*
|
||||
* flush the buffer manager pages. Note: if we have stable
|
||||
* main memory, dirty shared buffers are not flushed
|
||||
* plai 8/7/90
|
||||
/*
|
||||
* flush the buffer manager pages. Note: if we have stable main
|
||||
* memory, dirty shared buffers are not flushed plai 8/7/90
|
||||
*/
|
||||
leak = BufferPoolCheckLeak();
|
||||
|
||||
/*
|
||||
* If no one shared buffer was changed by this transaction then
|
||||
* we don't flush shared buffers and don't record commit status.
|
||||
* If no one shared buffer was changed by this transaction then we
|
||||
* don't flush shared buffers and don't record commit status.
|
||||
*/
|
||||
if (SharedBufferChanged)
|
||||
{
|
||||
@@ -645,13 +644,13 @@ RecordTransactionCommit()
|
||||
ResetBufferPool(true);
|
||||
|
||||
/*
|
||||
* have the transaction access methods record the status
|
||||
* of this transaction id in the pg_log relation.
|
||||
* have the transaction access methods record the status of this
|
||||
* transaction id in the pg_log relation.
|
||||
*/
|
||||
TransactionIdCommit(xid);
|
||||
|
||||
/*
|
||||
* Now write the log info to the disk too.
|
||||
* Now write the log info to the disk too.
|
||||
*/
|
||||
leak = BufferPoolCheckLeak();
|
||||
FlushBufferPool();
|
||||
@@ -751,10 +750,10 @@ RecordTransactionAbort()
|
||||
*/
|
||||
xid = GetCurrentTransactionId();
|
||||
|
||||
/*
|
||||
* Have the transaction access methods record the status of
|
||||
* this transaction id in the pg_log relation. We skip it
|
||||
* if no one shared buffer was changed by this transaction.
|
||||
/*
|
||||
* Have the transaction access methods record the status of this
|
||||
* transaction id in the pg_log relation. We skip it if no one shared
|
||||
* buffer was changed by this transaction.
|
||||
*/
|
||||
if (SharedBufferChanged && !TransactionIdDidCommit(xid))
|
||||
TransactionIdAbort(xid);
|
||||
@@ -936,7 +935,7 @@ CommitTransaction()
|
||||
/* ----------------
|
||||
* Tell the trigger manager that this transaction is about to be
|
||||
* committed. He'll invoke all trigger deferred until XACT before
|
||||
* we really start on committing the transaction.
|
||||
* we really start on committing the transaction.
|
||||
* ----------------
|
||||
*/
|
||||
DeferredTriggerEndXact();
|
||||
@@ -965,13 +964,13 @@ CommitTransaction()
|
||||
RecordTransactionCommit();
|
||||
|
||||
/*
|
||||
* Let others know about no transaction in progress by me.
|
||||
* Note that this must be done _before_ releasing locks we hold
|
||||
* and SpinAcquire(SInvalLock) is required: UPDATE with xid 0 is
|
||||
* blocked by xid 1' UPDATE, xid 1 is doing commit while xid 2
|
||||
* gets snapshot - if xid 2' GetSnapshotData sees xid 1 as running
|
||||
* then it must see xid 0 as running as well or it will see two
|
||||
* tuple versions - one deleted by xid 1 and one inserted by xid 0.
|
||||
* Let others know about no transaction in progress by me. Note that
|
||||
* this must be done _before_ releasing locks we hold and
|
||||
* SpinAcquire(SInvalLock) is required: UPDATE with xid 0 is blocked
|
||||
* by xid 1' UPDATE, xid 1 is doing commit while xid 2 gets snapshot -
|
||||
* if xid 2' GetSnapshotData sees xid 1 as running then it must see
|
||||
* xid 0 as running as well or it will see two tuple versions - one
|
||||
* deleted by xid 1 and one inserted by xid 0.
|
||||
*/
|
||||
if (MyProc != (PROC *) NULL)
|
||||
{
|
||||
@@ -995,7 +994,7 @@ CommitTransaction()
|
||||
* ----------------
|
||||
*/
|
||||
s->state = TRANS_DEFAULT;
|
||||
SharedBufferChanged = false; /* safest place to do it */
|
||||
SharedBufferChanged = false;/* safest place to do it */
|
||||
|
||||
}
|
||||
|
||||
@@ -1031,7 +1030,7 @@ AbortTransaction()
|
||||
|
||||
/* ----------------
|
||||
* Tell the trigger manager that this transaction is about to be
|
||||
* aborted.
|
||||
* aborted.
|
||||
* ----------------
|
||||
*/
|
||||
DeferredTriggerAbortXact();
|
||||
@@ -1070,7 +1069,7 @@ AbortTransaction()
|
||||
* ----------------
|
||||
*/
|
||||
s->state = TRANS_DEFAULT;
|
||||
SharedBufferChanged = false; /* safest place to do it */
|
||||
SharedBufferChanged = false;/* safest place to do it */
|
||||
}
|
||||
|
||||
/* --------------------------------
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user