mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
pgindent run over code.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.22 1999/03/14 05:08:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.23 1999/05/25 16:07:21 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* These functions are stored in pg_amproc. For each operator class
|
||||
@@ -40,7 +40,7 @@ btint4cmp(int32 a, int32 b)
|
||||
}
|
||||
|
||||
int32
|
||||
btint8cmp(int64 *a, int64 *b)
|
||||
btint8cmp(int64 * a, int64 * b)
|
||||
{
|
||||
if (*a > *b)
|
||||
return 1;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.39 1999/05/01 16:09:45 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.40 1999/05/25 16:07:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -99,13 +99,13 @@ l1:
|
||||
/* key on the page before trying to compare it */
|
||||
if (!PageIsEmpty(page) && offset <= maxoff)
|
||||
{
|
||||
TupleDesc itupdesc;
|
||||
BTItem cbti;
|
||||
HeapTupleData htup;
|
||||
BTPageOpaque opaque;
|
||||
Buffer nbuf;
|
||||
BlockNumber blkno;
|
||||
bool chtup = true;
|
||||
TupleDesc itupdesc;
|
||||
BTItem cbti;
|
||||
HeapTupleData htup;
|
||||
BTPageOpaque opaque;
|
||||
Buffer nbuf;
|
||||
BlockNumber blkno;
|
||||
bool chtup = true;
|
||||
|
||||
itupdesc = RelationGetDescr(rel);
|
||||
nbuf = InvalidBuffer;
|
||||
@@ -122,15 +122,16 @@ l1:
|
||||
*/
|
||||
while (_bt_isequal(itupdesc, page, offset, natts, itup_scankey))
|
||||
{ /* they're equal */
|
||||
|
||||
/*
|
||||
* Have to check is inserted heap tuple deleted one
|
||||
* (i.e. just moved to another place by vacuum)!
|
||||
* Have to check is inserted heap tuple deleted one (i.e.
|
||||
* just moved to another place by vacuum)!
|
||||
*/
|
||||
if (chtup)
|
||||
{
|
||||
htup.t_self = btitem->bti_itup.t_tid;
|
||||
heap_fetch(heapRel, SnapshotDirty, &htup, &buffer);
|
||||
if (htup.t_data == NULL) /* YES! */
|
||||
if (htup.t_data == NULL) /* YES! */
|
||||
break;
|
||||
/* Live tuple was inserted */
|
||||
ReleaseBuffer(buffer);
|
||||
@@ -139,11 +140,11 @@ l1:
|
||||
cbti = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
|
||||
htup.t_self = cbti->bti_itup.t_tid;
|
||||
heap_fetch(heapRel, SnapshotDirty, &htup, &buffer);
|
||||
if (htup.t_data != NULL) /* it is a duplicate */
|
||||
if (htup.t_data != NULL) /* it is a duplicate */
|
||||
{
|
||||
TransactionId xwait =
|
||||
(TransactionIdIsValid(SnapshotDirty->xmin)) ?
|
||||
SnapshotDirty->xmin : SnapshotDirty->xmax;
|
||||
TransactionId xwait =
|
||||
(TransactionIdIsValid(SnapshotDirty->xmin)) ?
|
||||
SnapshotDirty->xmin : SnapshotDirty->xmax;
|
||||
|
||||
/*
|
||||
* If this tuple is being updated by other transaction
|
||||
@@ -156,7 +157,7 @@ l1:
|
||||
_bt_relbuf(rel, nbuf, BT_READ);
|
||||
_bt_relbuf(rel, buf, BT_WRITE);
|
||||
XactLockTableWait(xwait);
|
||||
goto l1; /* continue from the begin */
|
||||
goto l1;/* continue from the begin */
|
||||
}
|
||||
elog(ERROR, "Cannot insert a duplicate key into a unique index");
|
||||
}
|
||||
@@ -571,10 +572,10 @@ _bt_insertonpg(Relation rel,
|
||||
* reasoning).
|
||||
*/
|
||||
|
||||
l_spl:;
|
||||
l_spl: ;
|
||||
if (stack == (BTStack) NULL)
|
||||
{
|
||||
if (!is_root) /* if this page was not root page */
|
||||
if (!is_root) /* if this page was not root page */
|
||||
{
|
||||
elog(DEBUG, "btree: concurrent ROOT page split");
|
||||
stack = (BTStack) palloc(sizeof(BTStackData));
|
||||
@@ -1144,8 +1145,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
|
||||
lpage = BufferGetPage(lbuf);
|
||||
rpage = BufferGetPage(rbuf);
|
||||
|
||||
((BTPageOpaque) PageGetSpecialPointer(lpage))->btpo_parent =
|
||||
((BTPageOpaque) PageGetSpecialPointer(rpage))->btpo_parent =
|
||||
((BTPageOpaque) PageGetSpecialPointer(lpage))->btpo_parent =
|
||||
((BTPageOpaque) PageGetSpecialPointer(rpage))->btpo_parent =
|
||||
rootbknum;
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.20 1999/04/22 08:19:59 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.21 1999/05/25 16:07:26 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Postgres btree pages look like ordinary relation pages. The opaque
|
||||
@@ -421,7 +421,7 @@ _bt_pageinit(Page page, Size size)
|
||||
MemSet(page, 0, size);
|
||||
|
||||
PageInit(page, size, sizeof(BTPageOpaqueData));
|
||||
((BTPageOpaque) PageGetSpecialPointer(page))->btpo_parent =
|
||||
((BTPageOpaque) PageGetSpecialPointer(page))->btpo_parent =
|
||||
InvalidBlockNumber;
|
||||
}
|
||||
|
||||
@@ -494,17 +494,16 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
|
||||
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
|
||||
maxoff = PageGetMaxOffsetNumber(page);
|
||||
|
||||
if (stack->bts_offset == InvalidOffsetNumber ||
|
||||
if (stack->bts_offset == InvalidOffsetNumber ||
|
||||
maxoff >= stack->bts_offset)
|
||||
{
|
||||
|
||||
/*
|
||||
* _bt_insertonpg set bts_offset to InvalidOffsetNumber
|
||||
* in the case of concurrent ROOT page split
|
||||
* _bt_insertonpg set bts_offset to InvalidOffsetNumber in the
|
||||
* case of concurrent ROOT page split
|
||||
*/
|
||||
if (stack->bts_offset == InvalidOffsetNumber)
|
||||
{
|
||||
i = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemid = PageGetItemId(page, stack->bts_offset);
|
||||
@@ -524,7 +523,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
|
||||
}
|
||||
|
||||
/* if the item has just moved right on this page, we're done */
|
||||
for ( ;
|
||||
for (;
|
||||
i <= maxoff;
|
||||
i = OffsetNumberNext(i))
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.37 1999/03/28 20:31:58 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.38 1999/05/25 16:07:27 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
@@ -367,7 +367,7 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
|
||||
btitem = _bt_formitem(itup);
|
||||
|
||||
res = _bt_doinsert(rel, btitem,
|
||||
IndexIsUnique(RelationGetRelid(rel)), heapRel);
|
||||
IndexIsUnique(RelationGetRelid(rel)), heapRel);
|
||||
|
||||
pfree(btitem);
|
||||
pfree(itup);
|
||||
@@ -391,9 +391,10 @@ btgettuple(IndexScanDesc scan, ScanDirection dir)
|
||||
|
||||
if (ItemPointerIsValid(&(scan->currentItemData)))
|
||||
{
|
||||
|
||||
/*
|
||||
* Restore scan position using heap TID returned
|
||||
* by previous call to btgettuple().
|
||||
* Restore scan position using heap TID returned by previous call
|
||||
* to btgettuple().
|
||||
*/
|
||||
_bt_restscan(scan);
|
||||
res = _bt_next(scan, dir);
|
||||
@@ -623,16 +624,15 @@ _bt_restscan(IndexScanDesc scan)
|
||||
BlockNumber blkno;
|
||||
|
||||
/*
|
||||
* We use this as flag when first index tuple on page
|
||||
* is deleted but we do not move left (this would
|
||||
* slowdown vacuum) - so we set current->ip_posid
|
||||
* before first index tuple on the current page
|
||||
* We use this as flag when first index tuple on page is deleted but
|
||||
* we do not move left (this would slowdown vacuum) - so we set
|
||||
* current->ip_posid before first index tuple on the current page
|
||||
* (_bt_step will move it right)...
|
||||
*/
|
||||
if (!ItemPointerIsValid(&target))
|
||||
{
|
||||
ItemPointerSetOffsetNumber(&(scan->currentItemData),
|
||||
OffsetNumberPrev(P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY));
|
||||
ItemPointerSetOffsetNumber(&(scan->currentItemData),
|
||||
OffsetNumberPrev(P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.20 1999/03/28 20:31:58 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.21 1999/05/25 16:07:29 momjian Exp $
|
||||
*
|
||||
*
|
||||
* NOTES
|
||||
@@ -112,12 +112,12 @@ _bt_adjscans(Relation rel, ItemPointer tid)
|
||||
static void
|
||||
_bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
|
||||
{
|
||||
ItemPointer current;
|
||||
Buffer buf;
|
||||
BTScanOpaque so;
|
||||
OffsetNumber start;
|
||||
Page page;
|
||||
BTPageOpaque opaque;
|
||||
ItemPointer current;
|
||||
Buffer buf;
|
||||
BTScanOpaque so;
|
||||
OffsetNumber start;
|
||||
Page page;
|
||||
BTPageOpaque opaque;
|
||||
|
||||
so = (BTScanOpaque) scan->opaque;
|
||||
buf = so->btso_curbuf;
|
||||
@@ -140,7 +140,7 @@ _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
|
||||
{
|
||||
Page pg = BufferGetPage(buf);
|
||||
BTItem btitem = (BTItem) PageGetItem(pg,
|
||||
PageGetItemId(pg, ItemPointerGetOffsetNumber(current)));
|
||||
PageGetItemId(pg, ItemPointerGetOffsetNumber(current)));
|
||||
|
||||
so->curHeapIptr = btitem->bti_itup.t_tid;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
|
||||
{
|
||||
Page pg = BufferGetPage(buf);
|
||||
BTItem btitem = (BTItem) PageGetItem(pg,
|
||||
PageGetItemId(pg, ItemPointerGetOffsetNumber(current)));
|
||||
PageGetItemId(pg, ItemPointerGetOffsetNumber(current)));
|
||||
|
||||
so->mrkHeapIptr = btitem->bti_itup.t_tid;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.43 1999/04/13 17:18:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.44 1999/05/25 16:07:31 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -706,7 +706,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
|
||||
so = (BTScanOpaque) scan->opaque;
|
||||
current = &(scan->currentItemData);
|
||||
|
||||
Assert (BufferIsValid(so->btso_curbuf));
|
||||
Assert(BufferIsValid(so->btso_curbuf));
|
||||
|
||||
/* we still have the buffer pinned and locked */
|
||||
buf = so->btso_curbuf;
|
||||
@@ -733,8 +733,8 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
|
||||
return res;
|
||||
}
|
||||
|
||||
} while (keysok >= so->numberOfFirstKeys ||
|
||||
(keysok == -1 && ScanDirectionIsBackward(dir)));
|
||||
} while (keysok >= so->numberOfFirstKeys ||
|
||||
(keysok == -1 && ScanDirectionIsBackward(dir)));
|
||||
|
||||
ItemPointerSetInvalid(current);
|
||||
so->btso_curbuf = InvalidBuffer;
|
||||
@@ -776,8 +776,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
BTScanOpaque so;
|
||||
ScanKeyData skdata;
|
||||
Size keysok;
|
||||
int i;
|
||||
int nKeyIndex = -1;
|
||||
int i;
|
||||
int nKeyIndex = -1;
|
||||
|
||||
rel = scan->relation;
|
||||
so = (BTScanOpaque) scan->opaque;
|
||||
@@ -795,27 +795,27 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
|
||||
if (ScanDirectionIsBackward(dir))
|
||||
{
|
||||
for (i=0; i<so->numberOfKeys; i++)
|
||||
for (i = 0; i < so->numberOfKeys; i++)
|
||||
{
|
||||
if (so->keyData[i].sk_attno != 1)
|
||||
break;
|
||||
strat = _bt_getstrat(rel, so->keyData[i].sk_attno,
|
||||
so->keyData[i].sk_procedure);
|
||||
strat = _bt_getstrat(rel, so->keyData[i].sk_attno,
|
||||
so->keyData[i].sk_procedure);
|
||||
if (strat == BTLessStrategyNumber ||
|
||||
strat == BTLessEqualStrategyNumber||
|
||||
strat == BTEqualStrategyNumber)
|
||||
strat == BTLessEqualStrategyNumber ||
|
||||
strat == BTEqualStrategyNumber)
|
||||
{
|
||||
nKeyIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
strat = _bt_getstrat(rel, 1, so->keyData[0].sk_procedure);
|
||||
|
||||
if (strat == BTLessStrategyNumber ||
|
||||
strat == BTLessEqualStrategyNumber)
|
||||
strat == BTLessEqualStrategyNumber)
|
||||
;
|
||||
else
|
||||
nKeyIndex = 0;
|
||||
@@ -850,7 +850,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
}
|
||||
proc = index_getprocid(rel, 1, BTORDER_PROC);
|
||||
ScanKeyEntryInitialize(&skdata, so->keyData[nKeyIndex].sk_flags,
|
||||
1, proc, so->keyData[nKeyIndex].sk_argument);
|
||||
1, proc, so->keyData[nKeyIndex].sk_argument);
|
||||
|
||||
stack = _bt_search(rel, 1, &skdata, &buf);
|
||||
_bt_freestack(stack);
|
||||
@@ -1104,9 +1104,10 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
|
||||
|
||||
rel = scan->relation;
|
||||
current = &(scan->currentItemData);
|
||||
|
||||
/*
|
||||
* Don't use ItemPointerGetOffsetNumber or you risk to get
|
||||
* assertion due to ability of ip_posid to be equal 0.
|
||||
* Don't use ItemPointerGetOffsetNumber or you risk to get assertion
|
||||
* due to ability of ip_posid to be equal 0.
|
||||
*/
|
||||
offnum = current->ip_posid;
|
||||
page = BufferGetPage(*bufP);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Id: nbtsort.c,v 1.38 1999/05/09 00:53:19 tgl Exp $
|
||||
* $Id: nbtsort.c,v 1.39 1999/05/25 16:07:34 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -552,16 +552,16 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
|
||||
btspool->bts_tape = 0;
|
||||
btspool->isunique = isunique;
|
||||
|
||||
btspool->bts_itape =(BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes);
|
||||
btspool->bts_otape =(BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes);
|
||||
btspool->bts_itape = (BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes);
|
||||
btspool->bts_otape = (BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes);
|
||||
if (btspool->bts_itape == (BTTapeBlock **) NULL ||
|
||||
btspool->bts_otape == (BTTapeBlock **) NULL)
|
||||
elog(ERROR, "_bt_spoolinit: out of memory");
|
||||
|
||||
for (i = 0; i < ntapes; ++i)
|
||||
{
|
||||
btspool->bts_itape[i] = _bt_tapecreate();
|
||||
btspool->bts_otape[i] = _bt_tapecreate();
|
||||
btspool->bts_itape[i] = _bt_tapecreate();
|
||||
btspool->bts_otape[i] = _bt_tapecreate();
|
||||
}
|
||||
|
||||
_bt_isortcmpinit(index, btspool);
|
||||
|
||||
Reference in New Issue
Block a user