mirror of
https://github.com/postgres/postgres.git
synced 2025-11-13 16:22:44 +03:00
Re-run pgindent, fixing a problem where comment lines after a blank
comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.128 2005/11/06 19:29:00 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.129 2005/11/22 18:17:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -104,8 +104,8 @@ top:
|
||||
* If we're not allowing duplicates, make sure the key isn't already in
|
||||
* the index.
|
||||
*
|
||||
* NOTE: obviously, _bt_check_unique can only detect keys that are already in
|
||||
* the index; so it cannot defend against concurrent insertions of the
|
||||
* NOTE: obviously, _bt_check_unique can only detect keys that are already
|
||||
* in the index; so it cannot defend against concurrent insertions of the
|
||||
* same key. We protect against that by means of holding a write lock on
|
||||
* the target page. Any other would-be inserter of the same key must
|
||||
* acquire a write lock on the same target page, so only one would-be
|
||||
@@ -114,8 +114,8 @@ top:
|
||||
* our insertion, so no later inserter can fail to see our insertion.
|
||||
* (This requires some care in _bt_insertonpg.)
|
||||
*
|
||||
* If we must wait for another xact, we release the lock while waiting, and
|
||||
* then must start over completely.
|
||||
* If we must wait for another xact, we release the lock while waiting,
|
||||
* and then must start over completely.
|
||||
*/
|
||||
if (index_is_unique)
|
||||
{
|
||||
@@ -193,8 +193,8 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
|
||||
/*
|
||||
* We can skip items that are marked killed.
|
||||
*
|
||||
* Formerly, we applied _bt_isequal() before checking the kill flag,
|
||||
* so as to fall out of the item loop as soon as possible.
|
||||
* Formerly, we applied _bt_isequal() before checking the kill
|
||||
* flag, so as to fall out of the item loop as soon as possible.
|
||||
* However, in the presence of heavy update activity an index may
|
||||
* contain many killed items with the same key; running
|
||||
* _bt_isequal() on each killed item gets expensive. Furthermore
|
||||
@@ -431,11 +431,11 @@ _bt_insertonpg(Relation rel,
|
||||
/*
|
||||
* step right to next non-dead page
|
||||
*
|
||||
* must write-lock that page before releasing write lock on current
|
||||
* page; else someone else's _bt_check_unique scan could fail to
|
||||
* see our insertion. write locks on intermediate dead pages
|
||||
* won't do because we don't know when they will get de-linked
|
||||
* from the tree.
|
||||
* must write-lock that page before releasing write lock on
|
||||
* current page; else someone else's _bt_check_unique scan could
|
||||
* fail to see our insertion. write locks on intermediate dead
|
||||
* pages won't do because we don't know when they will get
|
||||
* de-linked from the tree.
|
||||
*/
|
||||
Buffer rbuf = InvalidBuffer;
|
||||
|
||||
@@ -471,9 +471,9 @@ _bt_insertonpg(Relation rel,
|
||||
/*
|
||||
* Do we need to split the page to fit the item on it?
|
||||
*
|
||||
* Note: PageGetFreeSpace() subtracts sizeof(ItemIdData) from its result, so
|
||||
* this comparison is correct even though we appear to be accounting only
|
||||
* for the item and not for its line pointer.
|
||||
* Note: PageGetFreeSpace() subtracts sizeof(ItemIdData) from its result,
|
||||
* so this comparison is correct even though we appear to be accounting
|
||||
* only for the item and not for its line pointer.
|
||||
*/
|
||||
if (PageGetFreeSpace(page) < itemsz)
|
||||
{
|
||||
@@ -1158,10 +1158,10 @@ _bt_insert_parent(Relation rel,
|
||||
* the next higher level that someone constructed meanwhile, and find the
|
||||
* right place to insert as for the normal case.
|
||||
*
|
||||
* If we have to search for the parent level, we do so by re-descending from
|
||||
* the root. This is not super-efficient, but it's rare enough not to
|
||||
* matter. (This path is also taken when called from WAL recovery --- we
|
||||
* have no stack in that case.)
|
||||
* If we have to search for the parent level, we do so by re-descending
|
||||
* from the root. This is not super-efficient, but it's rare enough not
|
||||
* to matter. (This path is also taken when called from WAL recovery ---
|
||||
* we have no stack in that case.)
|
||||
*/
|
||||
if (is_root)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.89 2005/11/06 19:29:00 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.90 2005/11/22 18:17:06 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Postgres btree pages look like ordinary relation pages. The opaque
|
||||
@@ -412,16 +412,17 @@ _bt_checkpage(Relation rel, Buffer buf)
|
||||
Page page = BufferGetPage(buf);
|
||||
|
||||
/*
|
||||
* ReadBuffer verifies that every newly-read page passes PageHeaderIsValid,
|
||||
* which means it either contains a reasonably sane page header or is
|
||||
* all-zero. We have to defend against the all-zero case, however.
|
||||
* ReadBuffer verifies that every newly-read page passes
|
||||
* PageHeaderIsValid, which means it either contains a reasonably sane
|
||||
* page header or is all-zero. We have to defend against the all-zero
|
||||
* case, however.
|
||||
*/
|
||||
if (PageIsNew(page))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
errmsg("index \"%s\" contains unexpected zero page at block %u",
|
||||
RelationGetRelationName(rel),
|
||||
BufferGetBlockNumber(buf)),
|
||||
errmsg("index \"%s\" contains unexpected zero page at block %u",
|
||||
RelationGetRelationName(rel),
|
||||
BufferGetBlockNumber(buf)),
|
||||
errhint("Please REINDEX it.")));
|
||||
|
||||
/*
|
||||
@@ -440,7 +441,7 @@ _bt_checkpage(Relation rel, Buffer buf)
|
||||
/*
|
||||
* _bt_getbuf() -- Get a buffer by block number for read or write.
|
||||
*
|
||||
* blkno == P_NEW means to get an unallocated index page. The page
|
||||
* blkno == P_NEW means to get an unallocated index page. The page
|
||||
* will be initialized before returning it.
|
||||
*
|
||||
* When this routine returns, the appropriate lock is set on the
|
||||
@@ -475,21 +476,21 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access)
|
||||
* have been re-used between the time the last VACUUM scanned it and
|
||||
* the time the VACUUM made its FSM updates.)
|
||||
*
|
||||
* In fact, it's worse than that: we can't even assume that it's safe to
|
||||
* take a lock on the reported page. If somebody else has a lock on
|
||||
* it, or even worse our own caller does, we could deadlock. (The
|
||||
* In fact, it's worse than that: we can't even assume that it's safe
|
||||
* to take a lock on the reported page. If somebody else has a lock
|
||||
* on it, or even worse our own caller does, we could deadlock. (The
|
||||
* own-caller scenario is actually not improbable. Consider an index
|
||||
* on a serial or timestamp column. Nearly all splits will be at the
|
||||
* rightmost page, so it's entirely likely that _bt_split will call us
|
||||
* while holding a lock on the page most recently acquired from FSM.
|
||||
* A VACUUM running concurrently with the previous split could well
|
||||
* have placed that page back in FSM.)
|
||||
* while holding a lock on the page most recently acquired from FSM. A
|
||||
* VACUUM running concurrently with the previous split could well have
|
||||
* placed that page back in FSM.)
|
||||
*
|
||||
* To get around that, we ask for only a conditional lock on the reported
|
||||
* page. If we fail, then someone else is using the page, and we may
|
||||
* reasonably assume it's not free. (If we happen to be wrong, the
|
||||
* worst consequence is the page will be lost to use till the next
|
||||
* VACUUM, which is no big problem.)
|
||||
* To get around that, we ask for only a conditional lock on the
|
||||
* reported page. If we fail, then someone else is using the page,
|
||||
* and we may reasonably assume it's not free. (If we happen to be
|
||||
* wrong, the worst consequence is the page will be lost to use till
|
||||
* the next VACUUM, which is no big problem.)
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
@@ -839,12 +840,12 @@ _bt_pagedel(Relation rel, Buffer buf, bool vacuum_full)
|
||||
* We have to lock the pages we need to modify in the standard order:
|
||||
* moving right, then up. Else we will deadlock against other writers.
|
||||
*
|
||||
* So, we need to find and write-lock the current left sibling of the target
|
||||
* page. The sibling that was current a moment ago could have split, so
|
||||
* we may have to move right. This search could fail if either the
|
||||
* sibling or the target page was deleted by someone else meanwhile; if
|
||||
* so, give up. (Right now, that should never happen, since page deletion
|
||||
* is only done in VACUUM and there shouldn't be multiple VACUUMs
|
||||
* So, we need to find and write-lock the current left sibling of the
|
||||
* target page. The sibling that was current a moment ago could have
|
||||
* split, so we may have to move right. This search could fail if either
|
||||
* the sibling or the target page was deleted by someone else meanwhile;
|
||||
* if so, give up. (Right now, that should never happen, since page
|
||||
* deletion is only done in VACUUM and there shouldn't be multiple VACUUMs
|
||||
* concurrently on the same table.)
|
||||
*/
|
||||
if (leftsib != P_NONE)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.133 2005/11/06 19:29:00 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.134 2005/11/22 18:17:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -307,8 +307,8 @@ btgettuple(PG_FUNCTION_ARGS)
|
||||
* Save heap TID to use it in _bt_restscan. Then release the read lock on
|
||||
* the buffer so that we aren't blocking other backends.
|
||||
*
|
||||
* NOTE: we do keep the pin on the buffer! This is essential to ensure that
|
||||
* someone else doesn't delete the index entry we are stopped on.
|
||||
* NOTE: we do keep the pin on the buffer! This is essential to ensure
|
||||
* that someone else doesn't delete the index entry we are stopped on.
|
||||
*/
|
||||
if (res)
|
||||
{
|
||||
@@ -774,8 +774,8 @@ btvacuumcleanup(PG_FUNCTION_ARGS)
|
||||
|
||||
/*
|
||||
* We can't use _bt_getbuf() here because it always applies
|
||||
* _bt_checkpage(), which will barf on an all-zero page.
|
||||
* We want to recycle all-zero pages, not fail.
|
||||
* _bt_checkpage(), which will barf on an all-zero page. We want to
|
||||
* recycle all-zero pages, not fail.
|
||||
*/
|
||||
buf = ReadBuffer(rel, blkno);
|
||||
LockBuffer(buf, BT_READ);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.96 2005/10/18 01:06:23 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.97 2005/11/22 18:17:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -164,10 +164,11 @@ _bt_moveright(Relation rel,
|
||||
*
|
||||
* When nextkey = true: move right if the scan key is >= page's high key.
|
||||
*
|
||||
* The page could even have split more than once, so scan as far as needed.
|
||||
* The page could even have split more than once, so scan as far as
|
||||
* needed.
|
||||
*
|
||||
* We also have to move right if we followed a link that brought us to a dead
|
||||
* page.
|
||||
* We also have to move right if we followed a link that brought us to a
|
||||
* dead page.
|
||||
*/
|
||||
cmpval = nextkey ? 0 : 1;
|
||||
|
||||
@@ -255,8 +256,8 @@ _bt_binsrch(Relation rel,
|
||||
* For nextkey=false (cmpval=1), the loop invariant is: all slots before
|
||||
* 'low' are < scan key, all slots at or after 'high' are >= scan key.
|
||||
*
|
||||
* For nextkey=true (cmpval=0), the loop invariant is: all slots before 'low'
|
||||
* are <= scan key, all slots at or after 'high' are > scan key.
|
||||
* For nextkey=true (cmpval=0), the loop invariant is: all slots before
|
||||
* 'low' are <= scan key, all slots at or after 'high' are > scan key.
|
||||
*
|
||||
* We can fall out when high == low.
|
||||
*/
|
||||
@@ -282,8 +283,8 @@ _bt_binsrch(Relation rel,
|
||||
* At this point we have high == low, but be careful: they could point
|
||||
* past the last slot on the page.
|
||||
*
|
||||
* On a leaf page, we always return the first key >= scan key (resp. > scan
|
||||
* key), which could be the last slot + 1.
|
||||
* On a leaf page, we always return the first key >= scan key (resp. >
|
||||
* scan key), which could be the last slot + 1.
|
||||
*/
|
||||
if (P_ISLEAF(opaque))
|
||||
return low;
|
||||
@@ -350,8 +351,8 @@ _bt_compare(Relation rel,
|
||||
* you think about how multi-key ordering works, you'll understand why
|
||||
* this is.
|
||||
*
|
||||
* We don't test for violation of this condition here, however. The initial
|
||||
* setup for the index scan had better have gotten it right (see
|
||||
* We don't test for violation of this condition here, however. The
|
||||
* initial setup for the index scan had better have gotten it right (see
|
||||
* _bt_first).
|
||||
*/
|
||||
|
||||
@@ -692,9 +693,9 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
* where we need to start the scan, and set flag variables to control the
|
||||
* code below.
|
||||
*
|
||||
* If nextkey = false, _bt_search and _bt_binsrch will locate the first item
|
||||
* >= scan key. If nextkey = true, they will locate the first item > scan
|
||||
* key.
|
||||
* If nextkey = false, _bt_search and _bt_binsrch will locate the first
|
||||
* item >= scan key. If nextkey = true, they will locate the first item >
|
||||
* scan key.
|
||||
*
|
||||
* If goback = true, we will then step back one item, while if goback =
|
||||
* false, we will start the scan on the located item.
|
||||
@@ -819,9 +820,9 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
* than or equal to the scan key and we know that everything on later
|
||||
* pages is greater than scan key.
|
||||
*
|
||||
* The actually desired starting point is either this item or the prior one,
|
||||
* or in the end-of-page case it's the first item on the next page or the
|
||||
* last item on this page. We apply _bt_step if needed to get to the
|
||||
* The actually desired starting point is either this item or the prior
|
||||
* one, or in the end-of-page case it's the first item on the next page or
|
||||
* the last item on this page. We apply _bt_step if needed to get to the
|
||||
* right place.
|
||||
*
|
||||
* If _bt_step fails (meaning we fell off the end of the index in one
|
||||
@@ -1044,9 +1045,9 @@ _bt_walk_left(Relation rel, Buffer buf)
|
||||
* the original page got deleted and isn't in the sibling chain at all
|
||||
* anymore, not that its left sibling got split more than four times.
|
||||
*
|
||||
* Note that it is correct to test P_ISDELETED not P_IGNORE here, because
|
||||
* half-dead pages are still in the sibling chain. Caller must reject
|
||||
* half-dead pages if wanted.
|
||||
* Note that it is correct to test P_ISDELETED not P_IGNORE here,
|
||||
* because half-dead pages are still in the sibling chain. Caller
|
||||
* must reject half-dead pages if wanted.
|
||||
*/
|
||||
tries = 0;
|
||||
for (;;)
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.95 2005/10/15 02:49:09 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.96 2005/11/22 18:17:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -487,9 +487,9 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, BTItem bti)
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
if (btisz > BTMaxItemSize(npage))
|
||||
ereport(ERROR,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.65 2005/10/18 01:06:23 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.66 2005/11/22 18:17:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -549,8 +549,8 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple,
|
||||
* able to conclude no further tuples will pass, either. We have
|
||||
* to look at the scan direction and the qual type.
|
||||
*
|
||||
* Note: the only case in which we would keep going after failing a
|
||||
* required qual is if there are partially-redundant quals that
|
||||
* Note: the only case in which we would keep going after failing
|
||||
* a required qual is if there are partially-redundant quals that
|
||||
* _bt_preprocess_keys() was unable to eliminate. For example,
|
||||
* given "x > 4 AND x > 10" where both are cross-type comparisons
|
||||
* and so not removable, we might start the scan at the x = 4
|
||||
|
||||
Reference in New Issue
Block a user