mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
pgindent run for 9.6
This commit is contained in:
@ -33,11 +33,11 @@ PG_MODULE_MAGIC;
|
||||
typedef struct
|
||||
{
|
||||
BloomState blstate; /* bloom index state */
|
||||
MemoryContext tmpCtx; /* temporary memory context reset after
|
||||
* each tuple */
|
||||
MemoryContext tmpCtx; /* temporary memory context reset after each
|
||||
* tuple */
|
||||
char data[BLCKSZ]; /* cached page */
|
||||
int64 count; /* number of tuples in cached page */
|
||||
} BloomBuildState;
|
||||
} BloomBuildState;
|
||||
|
||||
/*
|
||||
* Flush page cached in BloomBuildState.
|
||||
@ -140,8 +140,8 @@ blbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
||||
bloomBuildCallback, (void *) &buildstate);
|
||||
|
||||
/*
|
||||
* There are could be some items in cached page. Flush this page
|
||||
* if needed.
|
||||
* There are could be some items in cached page. Flush this page if
|
||||
* needed.
|
||||
*/
|
||||
if (buildstate.count > 0)
|
||||
flushCachedPage(index, &buildstate);
|
||||
|
@ -31,14 +31,13 @@
|
||||
/* Opaque for bloom pages */
|
||||
typedef struct BloomPageOpaqueData
|
||||
{
|
||||
OffsetNumber maxoff; /* number of index tuples on page */
|
||||
uint16 flags; /* see bit definitions below */
|
||||
uint16 unused; /* placeholder to force maxaligning of size
|
||||
* of BloomPageOpaqueData and to place
|
||||
* bloom_page_id exactly at the end of page
|
||||
*/
|
||||
uint16 bloom_page_id; /* for identification of BLOOM indexes */
|
||||
} BloomPageOpaqueData;
|
||||
OffsetNumber maxoff; /* number of index tuples on page */
|
||||
uint16 flags; /* see bit definitions below */
|
||||
uint16 unused; /* placeholder to force maxaligning of size of
|
||||
* BloomPageOpaqueData and to place
|
||||
* bloom_page_id exactly at the end of page */
|
||||
uint16 bloom_page_id; /* for identification of BLOOM indexes */
|
||||
} BloomPageOpaqueData;
|
||||
|
||||
typedef BloomPageOpaqueData *BloomPageOpaque;
|
||||
|
||||
@ -102,9 +101,9 @@ typedef struct BloomOptions
|
||||
{
|
||||
int32 vl_len_; /* varlena header (do not touch directly!) */
|
||||
int bloomLength; /* length of signature in words (not bits!) */
|
||||
int bitSize[INDEX_MAX_KEYS]; /* # of bits generated for each
|
||||
* index key */
|
||||
} BloomOptions;
|
||||
int bitSize[INDEX_MAX_KEYS]; /* # of bits generated for
|
||||
* each index key */
|
||||
} BloomOptions;
|
||||
|
||||
/*
|
||||
* FreeBlockNumberArray - array of block numbers sized so that metadata fill
|
||||
@ -125,7 +124,7 @@ typedef struct BloomMetaPageData
|
||||
uint16 nEnd;
|
||||
BloomOptions opts;
|
||||
FreeBlockNumberArray notFullPage;
|
||||
} BloomMetaPageData;
|
||||
} BloomMetaPageData;
|
||||
|
||||
/* Magic number to distinguish bloom pages among anothers */
|
||||
#define BLOOM_MAGICK_NUMBER (0xDBAC0DED)
|
||||
@ -146,7 +145,7 @@ typedef struct BloomState
|
||||
* precompute it
|
||||
*/
|
||||
Size sizeOfBloomTuple;
|
||||
} BloomState;
|
||||
} BloomState;
|
||||
|
||||
#define BloomPageGetFreeSpace(state, page) \
|
||||
(BLCKSZ - MAXALIGN(SizeOfPageHeaderData) \
|
||||
@ -160,30 +159,30 @@ typedef struct BloomTuple
|
||||
{
|
||||
ItemPointerData heapPtr;
|
||||
BloomSignatureWord sign[FLEXIBLE_ARRAY_MEMBER];
|
||||
} BloomTuple;
|
||||
} BloomTuple;
|
||||
|
||||
#define BLOOMTUPLEHDRSZ offsetof(BloomTuple, sign)
|
||||
|
||||
/* Opaque data structure for bloom index scan */
|
||||
typedef struct BloomScanOpaqueData
|
||||
{
|
||||
BloomSignatureWord *sign; /* Scan signature */
|
||||
BloomSignatureWord *sign; /* Scan signature */
|
||||
BloomState state;
|
||||
} BloomScanOpaqueData;
|
||||
} BloomScanOpaqueData;
|
||||
|
||||
typedef BloomScanOpaqueData *BloomScanOpaque;
|
||||
|
||||
/* blutils.c */
|
||||
extern void _PG_init(void);
|
||||
extern Datum blhandler(PG_FUNCTION_ARGS);
|
||||
extern void initBloomState(BloomState * state, Relation index);
|
||||
extern void initBloomState(BloomState *state, Relation index);
|
||||
extern void BloomFillMetapage(Relation index, Page metaPage);
|
||||
extern void BloomInitMetapage(Relation index);
|
||||
extern void BloomInitPage(Page page, uint16 flags);
|
||||
extern Buffer BloomNewBuffer(Relation index);
|
||||
extern void signValue(BloomState * state, BloomSignatureWord * sign, Datum value, int attno);
|
||||
extern BloomTuple *BloomFormTuple(BloomState * state, ItemPointer iptr, Datum *values, bool *isnull);
|
||||
extern bool BloomPageAddItem(BloomState * state, Page page, BloomTuple * tuple);
|
||||
extern void signValue(BloomState *state, BloomSignatureWord *sign, Datum value, int attno);
|
||||
extern BloomTuple *BloomFormTuple(BloomState *state, ItemPointer iptr, Datum *values, bool *isnull);
|
||||
extern bool BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple);
|
||||
|
||||
/* blvalidate.c */
|
||||
extern bool blvalidate(Oid opclassoid);
|
||||
|
@ -37,6 +37,7 @@ PG_FUNCTION_INFO_V1(blhandler);
|
||||
|
||||
/* Kind of relation options for bloom index */
|
||||
static relopt_kind bl_relopt_kind;
|
||||
|
||||
/* parse table for fillRelOptions */
|
||||
static relopt_parse_elt bl_relopt_tab[INDEX_MAX_KEYS + 1];
|
||||
|
||||
@ -215,7 +216,9 @@ myRand(void)
|
||||
* October 1988, p. 1195.
|
||||
*----------
|
||||
*/
|
||||
int32 hi, lo, x;
|
||||
int32 hi,
|
||||
lo,
|
||||
x;
|
||||
|
||||
/* Must be in [1, 0x7ffffffe] range at this point. */
|
||||
hi = next / 127773;
|
||||
|
@ -78,7 +78,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
|
||||
/* Iterate over the tuples */
|
||||
itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber);
|
||||
itupEnd = BloomPageGetTuple(&state, page,
|
||||
OffsetNumberNext(BloomPageGetMaxOffset(page)));
|
||||
OffsetNumberNext(BloomPageGetMaxOffset(page)));
|
||||
while (itup < itupEnd)
|
||||
{
|
||||
/* Do we have to delete this tuple? */
|
||||
@ -106,11 +106,11 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
|
||||
}
|
||||
|
||||
Assert(itupPtr == BloomPageGetTuple(&state, page,
|
||||
OffsetNumberNext(BloomPageGetMaxOffset(page))));
|
||||
OffsetNumberNext(BloomPageGetMaxOffset(page))));
|
||||
|
||||
/*
|
||||
* Add page to notFullPage list if we will not mark page as deleted and
|
||||
* there is a free space on it
|
||||
* Add page to notFullPage list if we will not mark page as deleted
|
||||
* and there is a free space on it
|
||||
*/
|
||||
if (BloomPageGetMaxOffset(page) != 0 &&
|
||||
BloomPageGetFreeSpace(&state, page) > state.sizeOfBloomTuple &&
|
||||
|
Reference in New Issue
Block a user