1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +03:00

pgindent run for 8.2.

This commit is contained in:
Bruce Momjian
2006-10-04 00:30:14 +00:00
parent 451e419e98
commit f99a569a2e
522 changed files with 21297 additions and 17170 deletions

View File

@@ -1,9 +1,9 @@
/*--------------------------------------------------------------------------
* gin.h
* header file for postgres inverted index access method implementation.
* header file for postgres inverted index access method implementation.
*
* Copyright (c) 2006, PostgreSQL Global Development Group
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.7 2006/09/10 20:14:20 tgl Exp $
* Copyright (c) 2006, PostgreSQL Global Development Group
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.8 2006/10/04 00:30:06 momjian Exp $
*--------------------------------------------------------------------------
*/
@@ -25,51 +25,53 @@
/*
* amproc indexes for inverted indexes.
*/
#define GIN_COMPARE_PROC 1
#define GIN_EXTRACTVALUE_PROC 2
#define GIN_EXTRACTQUERY_PROC 3
#define GIN_CONSISTENT_PROC 4
#define GINNProcs 4
#define GIN_COMPARE_PROC 1
#define GIN_EXTRACTVALUE_PROC 2
#define GIN_EXTRACTQUERY_PROC 3
#define GIN_CONSISTENT_PROC 4
#define GINNProcs 4
typedef XLogRecPtr GinNSN;
/*
* Page opaque data in a inverted index page.
*/
typedef struct GinPageOpaqueData {
uint16 flags;
OffsetNumber maxoff; /* number entries on GIN_DATA page:
number of heap ItemPointer on GIN_DATA|GIN_LEAF page
and number of records on GIN_DATA & ~GIN_LEAF page
*/
BlockNumber rightlink;
typedef struct GinPageOpaqueData
{
uint16 flags;
OffsetNumber maxoff; /* number entries on GIN_DATA page: number of
* heap ItemPointer on GIN_DATA|GIN_LEAF page
* and number of records on GIN_DATA &
* ~GIN_LEAF page */
BlockNumber rightlink;
} GinPageOpaqueData;
typedef GinPageOpaqueData *GinPageOpaque;
#define GIN_ROOT_BLKNO (0)
typedef struct {
BlockIdData child_blkno; /* use it instead of BlockNumber to
save space on page */
ItemPointerData key;
typedef struct
{
BlockIdData child_blkno; /* use it instead of BlockNumber to save space
* on page */
ItemPointerData key;
} PostingItem;
#define PostingItemGetBlockNumber(pointer) \
#define PostingItemGetBlockNumber(pointer) \
BlockIdGetBlockNumber(&(pointer)->child_blkno)
#define PostingItemSetBlockNumber(pointer, blockNumber) \
#define PostingItemSetBlockNumber(pointer, blockNumber) \
BlockIdSet(&((pointer)->child_blkno), (blockNumber))
/*
* Page opaque data in a inverted index page.
*/
#define GIN_DATA (1 << 0)
#define GIN_LEAF (1 << 1)
#define GIN_DELETED (1 << 2)
#define GIN_DATA (1 << 0)
#define GIN_LEAF (1 << 1)
#define GIN_DELETED (1 << 2)
/*
* Works on page
* Works on page
*/
#define GinPageGetOpaque(page) ( (GinPageOpaque) PageGetSpecialPointer(page) )
@@ -103,15 +105,15 @@ typedef struct {
#define GinSetNPosting(itup,n) ItemPointerSetOffsetNumber(&(itup)->t_tid,(n))
#define GIN_TREE_POSTING ((OffsetNumber)0xffff)
#define GinIsPostingTree(itup) ( GinGetNPosting(itup)==GIN_TREE_POSTING )
#define GinSetPostingTree(itup, blkno) ( GinSetNPosting((itup),GIN_TREE_POSTING ), ItemPointerSetBlockNumber(&(itup)->t_tid, blkno) )
#define GinGetPostingTree(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid)
#define GinSetPostingTree(itup, blkno) ( GinSetNPosting((itup),GIN_TREE_POSTING ), ItemPointerSetBlockNumber(&(itup)->t_tid, blkno) )
#define GinGetPostingTree(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid)
#define GinGetOrigSizePosting(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid)
#define GinGetOrigSizePosting(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid)
#define GinSetOrigSizePosting(itup,n) ItemPointerSetBlockNumber(&(itup)->t_tid,(n))
#define GinGetPosting(itup) ( (ItemPointer)(( ((char*)(itup)) + SHORTALIGN(GinGetOrigSizePosting(itup)) )) )
#define GinMaxItemSize \
((BLCKSZ - SizeOfPageHeaderData - \
((BLCKSZ - SizeOfPageHeaderData - \
MAXALIGN(sizeof(GinPageOpaqueData))) / 3 - sizeof(ItemIdData))
@@ -121,8 +123,8 @@ typedef struct {
#define GinDataPageGetData(page) \
(PageGetContents(page)+MAXALIGN(sizeof(ItemPointerData)))
#define GinDataPageGetRightBound(page) ((ItemPointer)PageGetContents(page))
#define GinSizeOfItem(page) ( (GinPageIsLeaf(page)) ? sizeof(ItemPointerData) : sizeof(PostingItem) )
#define GinDataPageGetItem(page,i) ( GinDataPageGetData(page) + ((i)-1) * GinSizeOfItem(page) )
#define GinSizeOfItem(page) ( (GinPageIsLeaf(page)) ? sizeof(ItemPointerData) : sizeof(PostingItem) )
#define GinDataPageGetItem(page,i) ( GinDataPageGetData(page) + ((i)-1) * GinSizeOfItem(page) )
#define GinDataPageGetFreeSpace(page) \
( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GinPageOpaqueData)) - \
@@ -131,11 +133,12 @@ typedef struct {
#define GIN_UNLOCK BUFFER_LOCK_UNLOCK
#define GIN_SHARE BUFFER_LOCK_SHARE
#define GIN_UNLOCK BUFFER_LOCK_UNLOCK
#define GIN_SHARE BUFFER_LOCK_SHARE
#define GIN_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE
typedef struct GinState {
typedef struct GinState
{
FmgrInfo compareFn;
FmgrInfo extractValueFn;
FmgrInfo extractQueryFn;
@@ -150,80 +153,88 @@ typedef struct GinState {
#define XLOG_GIN_CREATE_PTREE 0x10
typedef struct ginxlogCreatePostingTree {
RelFileNode node;
BlockNumber blkno;
uint32 nitem;
typedef struct ginxlogCreatePostingTree
{
RelFileNode node;
BlockNumber blkno;
uint32 nitem;
/* follows list of heap's ItemPointer */
} ginxlogCreatePostingTree;
#define XLOG_GIN_INSERT 0x20
typedef struct ginxlogInsert {
RelFileNode node;
BlockNumber blkno;
BlockNumber updateBlkno;
OffsetNumber offset;
bool isDelete;
bool isData;
bool isLeaf;
OffsetNumber nitem;
typedef struct ginxlogInsert
{
RelFileNode node;
BlockNumber blkno;
BlockNumber updateBlkno;
OffsetNumber offset;
bool isDelete;
bool isData;
bool isLeaf;
OffsetNumber nitem;
/* follows: tuples or ItemPointerData or PostingItem or list of ItemPointerData*/
/*
* follows: tuples or ItemPointerData or PostingItem or list of
* ItemPointerData
*/
} ginxlogInsert;
#define XLOG_GIN_SPLIT 0x30
#define XLOG_GIN_SPLIT 0x30
typedef struct ginxlogSplit {
RelFileNode node;
BlockNumber lblkno;
BlockNumber rootBlkno;
BlockNumber rblkno;
BlockNumber rrlink;
OffsetNumber separator;
OffsetNumber nitem;
typedef struct ginxlogSplit
{
RelFileNode node;
BlockNumber lblkno;
BlockNumber rootBlkno;
BlockNumber rblkno;
BlockNumber rrlink;
OffsetNumber separator;
OffsetNumber nitem;
bool isData;
bool isLeaf;
bool isRootSplit;
bool isData;
bool isLeaf;
bool isRootSplit;
BlockNumber leftChildBlkno;
BlockNumber updateBlkno;
BlockNumber leftChildBlkno;
BlockNumber updateBlkno;
ItemPointerData rightbound; /* used only in posting tree */
ItemPointerData rightbound; /* used only in posting tree */
/* follows: list of tuple or ItemPointerData or PostingItem */
} ginxlogSplit;
#define XLOG_GIN_VACUUM_PAGE 0x40
#define XLOG_GIN_VACUUM_PAGE 0x40
typedef struct ginxlogVacuumPage {
RelFileNode node;
BlockNumber blkno;
OffsetNumber nitem;
typedef struct ginxlogVacuumPage
{
RelFileNode node;
BlockNumber blkno;
OffsetNumber nitem;
/* follows content of page */
} ginxlogVacuumPage;
#define XLOG_GIN_DELETE_PAGE 0x50
#define XLOG_GIN_DELETE_PAGE 0x50
typedef struct ginxlogDeletePage {
RelFileNode node;
BlockNumber blkno;
BlockNumber parentBlkno;
OffsetNumber parentOffset;
BlockNumber leftBlkno;
BlockNumber rightLink;
typedef struct ginxlogDeletePage
{
RelFileNode node;
BlockNumber blkno;
BlockNumber parentBlkno;
OffsetNumber parentOffset;
BlockNumber leftBlkno;
BlockNumber rightLink;
} ginxlogDeletePage;
/* ginutil.c */
extern Datum ginoptions(PG_FUNCTION_ARGS);
extern void initGinState( GinState *state, Relation index );
extern void initGinState(GinState *state, Relation index);
extern Buffer GinNewBuffer(Relation index);
extern void GinInitBuffer(Buffer b, uint32 f);
extern void GinInitPage(Page page, uint32 f, Size pageSize);
extern int compareEntries(GinState *ginstate, Datum a, Datum b);
extern Datum* extractEntriesS(GinState *ginstate, Datum value, uint32 *nentries);
extern Datum* extractEntriesSU(GinState *ginstate, Datum value, uint32 *nentries);
extern Page GinPageGetCopyPage( Page page );
extern int compareEntries(GinState *ginstate, Datum a, Datum b);
extern Datum *extractEntriesS(GinState *ginstate, Datum value, uint32 *nentries);
extern Datum *extractEntriesSU(GinState *ginstate, Datum value, uint32 *nentries);
extern Page GinPageGetCopyPage(Page page);
/* gininsert.c */
extern Datum ginbuild(PG_FUNCTION_ARGS);
@@ -238,147 +249,157 @@ extern bool gin_safe_restartpoint(void);
/* ginbtree.c */
typedef struct GinBtreeStack {
BlockNumber blkno;
Buffer buffer;
OffsetNumber off;
/* predictNumber contains prediction number of pages on current level */
uint32 predictNumber;
typedef struct GinBtreeStack
{
BlockNumber blkno;
Buffer buffer;
OffsetNumber off;
/* predictNumber contains prediction number of pages on current level */
uint32 predictNumber;
struct GinBtreeStack *parent;
} GinBtreeStack;
typedef struct GinBtreeData *GinBtree;
typedef struct GinBtreeData {
typedef struct GinBtreeData
{
/* search methods */
BlockNumber (*findChildPage)(GinBtree, GinBtreeStack *);
bool (*isMoveRight)(GinBtree, Page);
bool (*findItem)(GinBtree, GinBtreeStack *);
BlockNumber (*findChildPage) (GinBtree, GinBtreeStack *);
bool (*isMoveRight) (GinBtree, Page);
bool (*findItem) (GinBtree, GinBtreeStack *);
/* insert methods */
OffsetNumber (*findChildPtr)(GinBtree, Page, BlockNumber, OffsetNumber);
BlockNumber (*getLeftMostPage)(GinBtree, Page);
bool (*isEnoughSpace)(GinBtree, Buffer, OffsetNumber);
void (*placeToPage)(GinBtree, Buffer, OffsetNumber, XLogRecData**);
Page (*splitPage)(GinBtree, Buffer, Buffer, OffsetNumber, XLogRecData**);
void (*fillRoot)(GinBtree, Buffer, Buffer, Buffer);
OffsetNumber (*findChildPtr) (GinBtree, Page, BlockNumber, OffsetNumber);
BlockNumber (*getLeftMostPage) (GinBtree, Page);
bool (*isEnoughSpace) (GinBtree, Buffer, OffsetNumber);
void (*placeToPage) (GinBtree, Buffer, OffsetNumber, XLogRecData **);
Page (*splitPage) (GinBtree, Buffer, Buffer, OffsetNumber, XLogRecData **);
void (*fillRoot) (GinBtree, Buffer, Buffer, Buffer);
bool searchMode;
bool searchMode;
Relation index;
GinState *ginstate;
bool fullScan;
bool isBuild;
Relation index;
GinState *ginstate;
bool fullScan;
bool isBuild;
BlockNumber rightblkno;
BlockNumber rightblkno;
/* Entry options */
Datum entryValue;
IndexTuple entry;
bool isDelete;
Datum entryValue;
IndexTuple entry;
bool isDelete;
/* Data (posting tree) option */
ItemPointerData *items;
uint32 nitem;
uint32 curitem;
ItemPointerData *items;
uint32 nitem;
uint32 curitem;
PostingItem pitem;
PostingItem pitem;
} GinBtreeData;
extern GinBtreeStack* ginPrepareFindLeafPage(GinBtree btree, BlockNumber blkno);
extern GinBtreeStack* ginFindLeafPage(GinBtree btree, GinBtreeStack *stack );
extern void freeGinBtreeStack( GinBtreeStack *stack );
extern GinBtreeStack *ginPrepareFindLeafPage(GinBtree btree, BlockNumber blkno);
extern GinBtreeStack *ginFindLeafPage(GinBtree btree, GinBtreeStack *stack);
extern void freeGinBtreeStack(GinBtreeStack *stack);
extern void ginInsertValue(GinBtree btree, GinBtreeStack *stack);
extern void findParents( GinBtree btree, GinBtreeStack *stack, BlockNumber rootBlkno);
extern void findParents(GinBtree btree, GinBtreeStack *stack, BlockNumber rootBlkno);
/* ginentrypage.c */
extern IndexTuple GinFormTuple(GinState *ginstate, Datum key, ItemPointerData *ipd, uint32 nipd);
extern Datum ginGetHighKey(GinState *ginstate, Page page);
extern void prepareEntryScan( GinBtree btree, Relation index, Datum value, GinState *ginstate);
extern void prepareEntryScan(GinBtree btree, Relation index, Datum value, GinState *ginstate);
extern void entryFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf);
extern IndexTuple ginPageGetLinkItup(Buffer buf);
/* gindatapage.c */
extern int compareItemPointers( ItemPointer a, ItemPointer b );
extern void MergeItemPointers(
ItemPointerData *dst,
ItemPointerData *a, uint32 na,
ItemPointerData *b, uint32 nb
);
extern int compareItemPointers(ItemPointer a, ItemPointer b);
extern void
MergeItemPointers(
ItemPointerData *dst,
ItemPointerData *a, uint32 na,
ItemPointerData *b, uint32 nb
);
extern void GinDataPageAddItem( Page page, void *data, OffsetNumber offset );
extern void GinDataPageAddItem(Page page, void *data, OffsetNumber offset);
extern void PageDeletePostingItem(Page page, OffsetNumber offset);
typedef struct {
GinBtreeData btree;
GinBtreeStack *stack;
typedef struct
{
GinBtreeData btree;
GinBtreeStack *stack;
} GinPostingTreeScan;
extern GinPostingTreeScan* prepareScanPostingTree( Relation index,
BlockNumber rootBlkno, bool searchMode);
extern void insertItemPointer(GinPostingTreeScan *gdi,
ItemPointerData *items, uint32 nitem);
extern Buffer scanBeginPostingTree( GinPostingTreeScan *gdi );
extern GinPostingTreeScan *prepareScanPostingTree(Relation index,
BlockNumber rootBlkno, bool searchMode);
extern void insertItemPointer(GinPostingTreeScan *gdi,
ItemPointerData *items, uint32 nitem);
extern Buffer scanBeginPostingTree(GinPostingTreeScan *gdi);
extern void dataFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf);
extern void prepareDataScan( GinBtree btree, Relation index);
extern void prepareDataScan(GinBtree btree, Relation index);
/* ginscan.c */
typedef struct GinScanEntryData *GinScanEntry;
typedef struct GinScanEntryData {
typedef struct GinScanEntryData
{
/* link to the equals entry in current scan key */
GinScanEntry master;
GinScanEntry master;
/* link to values reported to consistentFn,
points to GinScanKey->entryRes[i]*/
bool *pval;
/*
* link to values reported to consistentFn, points to
* GinScanKey->entryRes[i]
*/
bool *pval;
/* entry, got from extractQueryFn */
Datum entry;
/* entry, got from extractQueryFn */
Datum entry;
/* current ItemPointer to heap, its offset in buffer and buffer */
ItemPointerData curItem;
OffsetNumber offset;
Buffer buffer;
ItemPointerData curItem;
OffsetNumber offset;
Buffer buffer;
/* in case of Posing list */
ItemPointerData *list;
uint32 nlist;
ItemPointerData *list;
uint32 nlist;
bool isFinished;
bool reduceResult;
uint32 predictNumberResult;
bool isFinished;
bool reduceResult;
uint32 predictNumberResult;
} GinScanEntryData;
typedef struct GinScanKeyData {
/* Number of entries in query (got by extractQueryFn) */
uint32 nentries;
typedef struct GinScanKeyData
{
/* Number of entries in query (got by extractQueryFn) */
uint32 nentries;
/* array of ItemPointer result, reported to consistentFn */
bool *entryRes;
bool *entryRes;
/* array of scans per entry */
GinScanEntry scanEntry;
/* array of scans per entry */
GinScanEntry scanEntry;
/* for calling consistentFn(GinScanKey->entryRes, strategy, query) */
StrategyNumber strategy;
Datum query;
StrategyNumber strategy;
Datum query;
ItemPointerData curItem;
bool firstCall;
bool isFinished;
ItemPointerData curItem;
bool firstCall;
bool isFinished;
} GinScanKeyData;
typedef GinScanKeyData *GinScanKey;
typedef GinScanKeyData *GinScanKey;
typedef struct GinScanOpaqueData {
MemoryContext tempCtx;
GinState ginstate;
typedef struct GinScanOpaqueData
{
MemoryContext tempCtx;
GinState ginstate;
GinScanKey keys;
uint32 nkeys;
GinScanKey keys;
uint32 nkeys;
GinScanKey markPos;
GinScanKey markPos;
} GinScanOpaqueData;
typedef GinScanOpaqueData *GinScanOpaque;
@@ -391,12 +412,12 @@ extern Datum ginrestrpos(PG_FUNCTION_ARGS);
extern void newScanKey(IndexScanDesc scan);
/* ginget.c */
extern DLLIMPORT int GinFuzzySearchLimit;
extern DLLIMPORT int GinFuzzySearchLimit;
#define ItemPointerSetMax(p) ItemPointerSet( (p), (BlockNumber)0xffffffff, (OffsetNumber)0xffff )
#define ItemPointerIsMax(p) ( ItemPointerGetBlockNumber(p) == (BlockNumber)0xffffffff && ItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff )
#define ItemPointerSetMin(p) ItemPointerSet( (p), (BlockNumber)0, (OffsetNumber)0)
#define ItemPointerIsMin(p) ( ItemPointerGetBlockNumber(p) == (BlockNumber)0 && ItemPointerGetOffsetNumber(p) == (OffsetNumber)0 )
#define ItemPointerSetMax(p) ItemPointerSet( (p), (BlockNumber)0xffffffff, (OffsetNumber)0xffff )
#define ItemPointerIsMax(p) ( ItemPointerGetBlockNumber(p) == (BlockNumber)0xffffffff && ItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff )
#define ItemPointerSetMin(p) ItemPointerSet( (p), (BlockNumber)0, (OffsetNumber)0)
#define ItemPointerIsMin(p) ( ItemPointerGetBlockNumber(p) == (BlockNumber)0 && ItemPointerGetOffsetNumber(p) == (OffsetNumber)0 )
extern Datum gingetmulti(PG_FUNCTION_ARGS);
extern Datum gingettuple(PG_FUNCTION_ARGS);
@@ -410,31 +431,33 @@ extern Datum ginarrayextract(PG_FUNCTION_ARGS);
extern Datum ginarrayconsistent(PG_FUNCTION_ARGS);
/* ginbulk.c */
typedef struct EntryAccumulator {
Datum value;
uint32 length;
uint32 number;
typedef struct EntryAccumulator
{
Datum value;
uint32 length;
uint32 number;
ItemPointerData *list;
bool shouldSort;
struct EntryAccumulator *left;
struct EntryAccumulator *right;
struct EntryAccumulator *left;
struct EntryAccumulator *right;
} EntryAccumulator;
typedef struct {
GinState *ginstate;
EntryAccumulator *entries;
typedef struct
{
GinState *ginstate;
EntryAccumulator *entries;
uint32 maxdepth;
EntryAccumulator **stack;
uint32 stackpos;
uint32 allocatedMemory;
EntryAccumulator **stack;
uint32 stackpos;
uint32 allocatedMemory;
uint32 length;
EntryAccumulator *entryallocator;
uint32 length;
EntryAccumulator *entryallocator;
} BuildAccumulator;
extern void ginInitBA(BuildAccumulator *accum);
extern void ginInsertRecordBA( BuildAccumulator *accum,
ItemPointer heapptr, Datum *entries, uint32 nentry );
extern ItemPointerData* ginGetEntry(BuildAccumulator *accum, Datum *entry, uint32 *n);
extern void ginInsertRecordBA(BuildAccumulator *accum,
ItemPointer heapptr, Datum *entries, uint32 nentry);
extern ItemPointerData *ginGetEntry(BuildAccumulator *accum, Datum *entry, uint32 *n);
#endif

View File

@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/gist.h,v 1.55 2006/09/10 00:29:34 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/gist.h,v 1.56 2006/10/04 00:30:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,7 +80,7 @@ typedef GISTPageOpaqueData *GISTPageOpaque;
* PickSplit should check spl_(r|l)datum_exists. If it is 'true',
* that corresponding spl_(r|l)datum already defined and
* PickSplit should use that value. PickSplit should always set
* spl_(r|l)datum_exists to false: GiST will check value to
* spl_(r|l)datum_exists to false: GiST will check value to
* control supportng this feature by PickSplit...
*/
typedef struct GIST_SPLITVEC
@@ -88,12 +88,12 @@ typedef struct GIST_SPLITVEC
OffsetNumber *spl_left; /* array of entries that go left */
int spl_nleft; /* size of this array */
Datum spl_ldatum; /* Union of keys in spl_left */
bool spl_ldatum_exists; /* true, if spl_ldatum already exists. */
bool spl_ldatum_exists; /* true, if spl_ldatum already exists. */
OffsetNumber *spl_right; /* array of entries that go right */
int spl_nright; /* size of the array */
Datum spl_rdatum; /* Union of keys in spl_right */
bool spl_rdatum_exists; /* true, if spl_rdatum already exists. */
bool spl_rdatum_exists; /* true, if spl_rdatum already exists. */
} GIST_SPLITVEC;
/*

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.23 2006/08/07 16:57:57 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.24 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -144,7 +144,7 @@ typedef struct SplitedPageLayout
gistxlogPage block;
IndexTupleData *list;
int lenlist;
IndexTuple itup; /* union key for page */
IndexTuple itup; /* union key for page */
Page page; /* to operate */
Buffer buffer; /* to write after all proceed */
@@ -180,19 +180,22 @@ typedef struct GISTInsertStack
struct GISTInsertStack *next;
} GISTInsertStack;
typedef struct GistSplitVector {
GIST_SPLITVEC splitVector; /* to/from PickSplit method */
typedef struct GistSplitVector
{
GIST_SPLITVEC splitVector; /* to/from PickSplit method */
Datum spl_lattr[INDEX_MAX_KEYS]; /* Union of subkeys in spl_left */
bool spl_lisnull[INDEX_MAX_KEYS];
bool spl_leftvalid;
Datum spl_lattr[INDEX_MAX_KEYS]; /* Union of subkeys in
* spl_left */
bool spl_lisnull[INDEX_MAX_KEYS];
bool spl_leftvalid;
Datum spl_rattr[INDEX_MAX_KEYS]; /* Union of subkeys in spl_right */
bool spl_risnull[INDEX_MAX_KEYS];
bool spl_rightvalid;
Datum spl_rattr[INDEX_MAX_KEYS]; /* Union of subkeys in
* spl_right */
bool spl_risnull[INDEX_MAX_KEYS];
bool spl_rightvalid;
bool *spl_equiv; /* equivalent tuples which can be freely
* distributed between left and right pages */
bool *spl_equiv; /* equivalent tuples which can be freely
* distributed between left and right pages */
} GistSplitVector;
#define XLogRecPtrIsInvalid( r ) ( (r).xlogid == 0 && (r).xrecoff == 0 )
@@ -255,7 +258,7 @@ extern bool gist_safe_restartpoint(void);
extern IndexTuple gist_form_invalid_tuple(BlockNumber blkno);
extern XLogRecData *formUpdateRdata(RelFileNode node, Buffer buffer,
OffsetNumber *todelete, int ntodelete,
OffsetNumber *todelete, int ntodelete,
IndexTuple *itup, int ituplen, ItemPointer key);
extern XLogRecData *formSplitRdata(RelFileNode node,
@@ -271,7 +274,7 @@ extern Datum gistgetmulti(PG_FUNCTION_ARGS);
/* gistutil.c */
#define GiSTPageSize \
( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GISTPageOpaqueData)) )
( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GISTPageOpaqueData)) )
#define GIST_MIN_FILLFACTOR 10
#define GIST_DEFAULT_FILLFACTOR 90
@@ -287,7 +290,7 @@ extern IndexTuple *gistextractpage(Page page, int *len /* out */ );
extern IndexTuple *gistjoinvector(
IndexTuple *itvec, int *len,
IndexTuple *additvec, int addlen);
extern IndexTupleData* gistfillitupvec(IndexTuple *vec, int veclen, int *memlen);
extern IndexTupleData *gistfillitupvec(IndexTuple *vec, int veclen, int *memlen);
extern IndexTuple gistunion(Relation r, IndexTuple *itvec,
int len, GISTSTATE *giststate);
@@ -312,27 +315,27 @@ extern void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
bool l, bool isNull);
extern float gistpenalty(GISTSTATE *giststate, int attno,
GISTENTRY *key1, bool isNull1,
GISTENTRY *key2, bool isNull2);
GISTENTRY *key1, bool isNull1,
GISTENTRY *key2, bool isNull2);
extern bool gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, int startkey,
Datum *attr, bool *isnull );
Datum *attr, bool *isnull);
extern bool gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b);
extern void gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p,
OffsetNumber o, GISTENTRY *attdata, bool *isnull);
OffsetNumber o, GISTENTRY *attdata, bool *isnull);
extern void gistMakeUnionKey( GISTSTATE *giststate, int attno,
GISTENTRY *entry1, bool isnull1,
GISTENTRY *entry2, bool isnull2,
Datum *dst, bool *dstisnull );
extern void gistMakeUnionKey(GISTSTATE *giststate, int attno,
GISTENTRY *entry1, bool isnull1,
GISTENTRY *entry2, bool isnull2,
Datum *dst, bool *dstisnull);
/* gistvacuum.c */
extern Datum gistbulkdelete(PG_FUNCTION_ARGS);
extern Datum gistvacuumcleanup(PG_FUNCTION_ARGS);
/* gistsplit.c */
extern void gistSplitByKey(Relation r, Page page, IndexTuple *itup,
int len, GISTSTATE *giststate,
GistSplitVector *v, GistEntryVector *entryvec,
int attno);
extern void gistSplitByKey(Relation r, Page page, IndexTuple *itup,
int len, GISTSTATE *giststate,
GistSplitVector *v, GistEntryVector *entryvec,
int attno);
#endif /* GIST_PRIVATE_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.115 2006/08/18 16:09:10 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.116 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -220,7 +220,7 @@ extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc,
Datum *values, char *nulls);
extern void heap_freetuple(HeapTuple htup);
extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
Datum *values, bool *isnull);
extern void heap_free_minimal_tuple(MinimalTuple mtup);
extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup);
extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup);

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/hio.h,v 1.32 2006/07/13 17:47:01 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/hio.h,v 1.33 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,6 +21,6 @@
extern void RelationPutHeapTuple(Relation relation, Buffer buffer,
HeapTuple tuple);
extern Buffer RelationGetBufferForTuple(Relation relation, Size len,
Buffer otherBuffer, bool use_fsm);
Buffer otherBuffer, bool use_fsm);
#endif /* HIO_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.85 2006/07/13 17:47:01 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.86 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -356,7 +356,7 @@ do { \
* MinimalTuple is an alternate representation that is used for transient
* tuples inside the executor, in places where transaction status information
* is not required, the tuple rowtype is known, and shaving off a few bytes
* is worthwhile because we need to store many tuples. The representation
* is worthwhile because we need to store many tuples. The representation
* is chosen so that tuple access routines can work with either full or
* minimal tuples via a HeapTupleData pointer structure. The access routines
* see no difference, except that they must not access the transaction status
@@ -367,7 +367,7 @@ do { \
* and thereby prevent accidental use of the nonexistent fields.
*
* MinimalTupleData contains a length word, some padding, and fields matching
* HeapTupleHeaderData beginning with t_natts. The padding is chosen so that
* HeapTupleHeaderData beginning with t_natts. The padding is chosen so that
* offsetof(t_natts) is the same modulo MAXIMUM_ALIGNOF in both structs.
* This makes data alignment rules equivalent in both cases.
*
@@ -431,7 +431,7 @@ typedef MinimalTupleData *MinimalTuple;
* limited contexts where the code knows that case #1 will never apply.)
*
* * Separately allocated minimal tuple: t_data points MINIMAL_TUPLE_OFFSET
* bytes before the start of a MinimalTuple. As with the previous case,
* bytes before the start of a MinimalTuple. As with the previous case,
* this can't be told apart from case #1 by inspection; code setting up
* or destroying this representation has to know what it's doing.
*

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.104 2006/08/24 01:18:34 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.105 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,10 +35,10 @@ typedef uint16 BTCycleId;
* and status. If the page is deleted, we replace the level with the
* next-transaction-ID value indicating when it is safe to reclaim the page.
*
* We also store a "vacuum cycle ID". When a page is split while VACUUM is
* We also store a "vacuum cycle ID". When a page is split while VACUUM is
* processing the index, a nonzero value associated with the VACUUM run is
* stored into both halves of the split page. (If VACUUM is not running,
* both pages receive zero cycleids.) This allows VACUUM to detect whether
* stored into both halves of the split page. (If VACUUM is not running,
* both pages receive zero cycleids.) This allows VACUUM to detect whether
* a page was split since it started, with a small probability of false match
* if the page was last split some exact multiple of 65536 VACUUMs ago.
* Also, during a split, the BTP_SPLIT_END flag is cleared in the left
@@ -71,7 +71,7 @@ typedef BTPageOpaqueData *BTPageOpaque;
#define BTP_META (1 << 3) /* meta-page */
#define BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */
#define BTP_SPLIT_END (1 << 5) /* rightmost page of split group */
#define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DELETEd tuples */
#define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DELETEd tuples */
/*
@@ -140,7 +140,7 @@ typedef struct BTMetaPageData
( (i1).ip_blkid.bi_hi == (i2).ip_blkid.bi_hi && \
(i1).ip_blkid.bi_lo == (i2).ip_blkid.bi_lo && \
(i1).ip_posid == (i2).ip_posid )
#define BTEntrySame(i1, i2) \
#define BTEntrySame(i1, i2) \
BTTidSame((i1)->t_tid, (i2)->t_tid)
@@ -203,7 +203,7 @@ typedef struct BTMetaPageData
#define XLOG_BTREE_SPLIT_R_ROOT 0x60 /* as above, new item on right */
#define XLOG_BTREE_DELETE 0x70 /* delete leaf index tuple */
#define XLOG_BTREE_DELETE_PAGE 0x80 /* delete an entire page */
#define XLOG_BTREE_DELETE_PAGE_META 0x90 /* same, plus update metapage */
#define XLOG_BTREE_DELETE_PAGE_META 0x90 /* same, plus update metapage */
#define XLOG_BTREE_NEWROOT 0xA0 /* new root page */
/*
@@ -368,17 +368,17 @@ typedef BTStackData *BTStack;
* BTScanOpaqueData is the btree-private state needed for an indexscan.
* This consists of preprocessed scan keys (see _bt_preprocess_keys() for
* details of the preprocessing), information about the current location
* of the scan, and information about the marked location, if any. (We use
* of the scan, and information about the marked location, if any. (We use
* BTScanPosData to represent the data needed for each of current and marked
* locations.) In addition we can remember some known-killed index entries
* locations.) In addition we can remember some known-killed index entries
* that must be marked before we can move off the current page.
*
* Index scans work a page at a time: we pin and read-lock the page, identify
* all the matching items on the page and save them in BTScanPosData, then
* release the read-lock while returning the items to the caller for
* processing. This approach minimizes lock/unlock traffic. Note that we
* processing. This approach minimizes lock/unlock traffic. Note that we
* keep the pin on the index page until the caller is done with all the items
* (this is needed for VACUUM synchronization, see nbtree/README). When we
* (this is needed for VACUUM synchronization, see nbtree/README). When we
* are ready to step to the next page, if the caller has told us any of the
* items were killed, we re-lock the page to mark them killed, then unlock.
* Finally we drop the pin and step to the next page in the appropriate
@@ -420,7 +420,7 @@ typedef struct BTScanPosData
int lastItem; /* last valid index in items[] */
int itemIndex; /* current index in items[] */
BTScanPosItem items[MaxIndexTuplesPerPage]; /* MUST BE LAST */
BTScanPosItem items[MaxIndexTuplesPerPage]; /* MUST BE LAST */
} BTScanPosData;
typedef BTScanPosData *BTScanPos;
@@ -439,11 +439,11 @@ typedef struct BTScanOpaqueData
int numKilled; /* number of currently stored items */
/*
* If the marked position is on the same page as current position,
* we don't use markPos, but just keep the marked itemIndex in
* markItemIndex (all the rest of currPos is valid for the mark position).
* Hence, to determine if there is a mark, first look at markItemIndex,
* then at markPos.
* If the marked position is on the same page as current position, we
* don't use markPos, but just keep the marked itemIndex in markItemIndex
* (all the rest of currPos is valid for the mark position). Hence, to
* determine if there is a mark, first look at markItemIndex, then at
* markPos.
*/
int markItemIndex; /* itemIndex, or -1 if not valid */
@@ -457,8 +457,8 @@ typedef BTScanOpaqueData *BTScanOpaque;
/*
* We use these private sk_flags bits in preprocessed scan keys
*/
#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */
#define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */
#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */
#define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */
/*
@@ -528,8 +528,8 @@ extern void _bt_freeskey(ScanKey skey);
extern void _bt_freestack(BTStack stack);
extern void _bt_preprocess_keys(IndexScanDesc scan);
extern bool _bt_checkkeys(IndexScanDesc scan,
Page page, OffsetNumber offnum,
ScanDirection dir, bool *continuescan);
Page page, OffsetNumber offnum,
ScanDirection dir, bool *continuescan);
extern void _bt_killitems(IndexScanDesc scan, bool haveLock);
extern BTCycleId _bt_vacuum_cycleid(Relation rel);
extern BTCycleId _bt_start_vacuum(Relation rel);

View File

@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/reloptions.h,v 1.1 2006/07/03 22:45:40 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/reloptions.h,v 1.2 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,18 +21,18 @@
#include "nodes/pg_list.h"
extern Datum transformRelOptions(Datum oldOptions, List *defList,
bool ignoreOids, bool isReset);
bool ignoreOids, bool isReset);
extern void parseRelOptions(Datum options, int numkeywords,
const char * const *keywords,
char **values, bool validate);
const char *const * keywords,
char **values, bool validate);
extern bytea *default_reloptions(Datum reloptions, bool validate,
int minFillfactor, int defaultFillfactor);
int minFillfactor, int defaultFillfactor);
extern bytea *heap_reloptions(char relkind, Datum reloptions, bool validate);
extern bytea *index_reloptions(RegProcedure amoptions, Datum reloptions,
bool validate);
bool validate);
#endif /* RELOPTIONS_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.49 2006/07/31 20:09:05 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.50 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,12 +27,12 @@ typedef struct HeapScanDescData
int rs_nkeys; /* number of scan keys */
ScanKey rs_key; /* array of scan key descriptors */
BlockNumber rs_nblocks; /* number of blocks to scan */
bool rs_pageatatime; /* verify visibility page-at-a-time? */
bool rs_pageatatime; /* verify visibility page-at-a-time? */
/* scan current state */
bool rs_inited; /* false = scan not init'd yet */
HeapTupleData rs_ctup; /* current tuple in scan, if any */
BlockNumber rs_cblock; /* current block # in scan, if any */
BlockNumber rs_cblock; /* current block # in scan, if any */
Buffer rs_cbuf; /* current buffer in scan, if any */
/* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
ItemPointerData rs_mctid; /* marked scan position, if any */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/skey.h,v 1.32 2006/03/05 15:58:53 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/skey.h,v 1.33 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -89,7 +89,7 @@ typedef ScanKeyData *ScanKey;
* must be sorted according to the leading column number.
*
* The subsidiary ScanKey array appears in logical column order of the row
* comparison, which may be different from index column order. The array
* comparison, which may be different from index column order. The array
* elements are like a normal ScanKey array except that:
* sk_flags must include SK_ROW_MEMBER, plus SK_ROW_END in the last
* element (needed since row header does not include a count)

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/slru.h,v 1.18 2006/03/05 15:58:53 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/slru.h,v 1.19 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -111,8 +111,8 @@ extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots,
LWLockId ctllock, const char *subdir);
extern int SimpleLruZeroPage(SlruCtl ctl, int pageno);
extern int SimpleLruReadPage(SlruCtl ctl, int pageno, TransactionId xid);
extern int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno,
TransactionId xid);
extern int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno,
TransactionId xid);
extern void SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata);
extern void SimpleLruFlush(SlruCtl ctl, bool checkpoint);
extern void SimpleLruTruncate(SlruCtl ctl, int cutoffPage);

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/tupdesc.h,v 1.50 2006/06/16 18:42:23 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/tupdesc.h,v 1.51 2006/10/04 00:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -104,7 +104,7 @@ extern void DecrTupleDescRefCount(TupleDesc tupdesc);
if ((tupdesc)->tdrefcount >= 0) \
DecrTupleDescRefCount(tupdesc); \
} while (0)
extern bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
extern void TupleDescInitEntry(TupleDesc desc,

View File

@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.16 2006/08/17 23:04:08 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.17 2006/10/04 00:30:07 momjian Exp $
*/
#ifndef XLOG_INTERNAL_H
#define XLOG_INTERNAL_H
@@ -239,7 +239,7 @@ typedef struct RmgrData
extern const RmgrData RmgrTable[];
/*
/*
* Exported to support xlog switching from bgwriter
*/
extern time_t GetLastSegSwitchTime(void);