diff options
Diffstat (limited to 'src/backend/access/gin')
-rw-r--r-- | src/backend/access/gin/ginbulk.c | 61 | ||||
-rw-r--r-- | src/backend/access/gin/ginentrypage.c | 4 | ||||
-rw-r--r-- | src/backend/access/gin/ginget.c | 16 |
3 files changed, 41 insertions, 40 deletions
diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c index accd6640375..bb726e69f4c 100644 --- a/src/backend/access/gin/ginbulk.c +++ b/src/backend/access/gin/ginbulk.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.18 2010/02/11 14:29:50 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.19 2010/02/26 02:00:33 momjian Exp $ *------------------------------------------------------------------------- */ @@ -22,20 +22,20 @@ #define DEF_NENTRY 2048 #define DEF_NPTR 4 -static void* +static void * ginAppendData(void *old, void *new, void *arg) { - EntryAccumulator *eo = (EntryAccumulator*)old, - *en = (EntryAccumulator*)new; + EntryAccumulator *eo = (EntryAccumulator *) old, + *en = (EntryAccumulator *) new; - BuildAccumulator *accum = (BuildAccumulator*)arg; + BuildAccumulator *accum = (BuildAccumulator *) arg; if (eo->number >= eo->length) { accum->allocatedMemory -= GetMemoryChunkSpace(eo->list); eo->length *= 2; eo->list = (ItemPointerData *) repalloc(eo->list, - sizeof(ItemPointerData) * eo->length); + sizeof(ItemPointerData) * eo->length); accum->allocatedMemory += GetMemoryChunkSpace(eo->list); } @@ -60,9 +60,9 @@ ginAppendData(void *old, void *new, void *arg) static int cmpEntryAccumulator(const void *a, const void *b, void *arg) { - EntryAccumulator *ea = (EntryAccumulator*)a; - EntryAccumulator *eb = (EntryAccumulator*)b; - BuildAccumulator *accum = (BuildAccumulator*)arg; + EntryAccumulator *ea = (EntryAccumulator *) a; + EntryAccumulator *eb = (EntryAccumulator *) b; + BuildAccumulator *accum = (BuildAccumulator *) arg; return compareAttEntries(accum->ginstate, ea->attnum, ea->value, eb->attnum, eb->value); @@ -104,13 +104,13 @@ getDatumCopy(BuildAccumulator *accum, OffsetNumber attnum, Datum value) static void ginInsertEntry(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, Datum entry) { - EntryAccumulator *key, - *ea; + EntryAccumulator *key, + *ea; - /* - * Allocate memory by rather big chunk to decrease overhead, we don't - * keep pointer to previously allocated chunks because they will free - * by MemoryContextReset() call. + /* + * Allocate memory by rather big chunk to decrease overhead, we don't keep + * pointer to previously allocated chunks because they will free by + * MemoryContextReset() call. */ if (accum->entryallocator == NULL || accum->length >= DEF_NENTRY) { @@ -125,7 +125,7 @@ ginInsertEntry(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum key->attnum = attnum; key->value = entry; - /* To prevent multiple palloc/pfree cycles, we reuse array */ + /* To prevent multiple palloc/pfree cycles, we reuse array */ if (accum->tmpList == NULL) accum->tmpList = (ItemPointerData *) palloc(sizeof(ItemPointerData) * DEF_NPTR); @@ -149,8 +149,8 @@ ginInsertEntry(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum else { /* - * The key has been appended, so "free" allocated - * key by decrementing chunk's counter. + * The key has been appended, so "free" allocated key by decrementing + * chunk's counter. */ accum->length--; } @@ -162,7 +162,7 @@ ginInsertEntry(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum * Since the entries are being inserted into a balanced binary tree, you * might think that the order of insertion wouldn't be critical, but it turns * out that inserting the entries in sorted order results in a lot of - * rebalancing operations and is slow. To prevent this, we attempt to insert + * rebalancing operations and is slow. To prevent this, we attempt to insert * the nodes in an order that will produce a nearly-balanced tree if the input * is in fact sorted. * @@ -172,11 +172,11 @@ ginInsertEntry(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum * tree; then, we insert the middles of each half of out virtual array, then * middles of quarters, etc. */ - void +void ginInsertRecordBA(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, Datum *entries, int32 nentry) { - uint32 step = nentry; + uint32 step = nentry; if (nentry <= 0) return; @@ -186,21 +186,22 @@ ginInsertRecordBA(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber att /* * step will contain largest power of 2 and <= nentry */ - step |= (step >> 1); - step |= (step >> 2); - step |= (step >> 4); - step |= (step >> 8); + step |= (step >> 1); + step |= (step >> 2); + step |= (step >> 4); + step |= (step >> 8); step |= (step >> 16); step >>= 1; - step ++; + step++; - while(step > 0) { - int i; + while (step > 0) + { + int i; - for (i = step - 1; i < nentry && i >= 0; i += step << 1 /* *2 */) + for (i = step - 1; i < nentry && i >= 0; i += step << 1 /* *2 */ ) ginInsertEntry(accum, heapptr, attnum, entries[i]); - step >>= 1; /* /2 */ + step >>= 1; /* /2 */ } } diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c index 8913b437cf6..6d307c8d59a 100644 --- a/src/backend/access/gin/ginentrypage.c +++ b/src/backend/access/gin/ginentrypage.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.23 2010/01/02 16:57:33 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.24 2010/02/26 02:00:33 momjian Exp $ *------------------------------------------------------------------------- */ @@ -104,7 +104,7 @@ GinFormTuple(Relation index, GinState *ginstate, * Gin tuple without any ItemPointers should be large enough to keep * one ItemPointer, to prevent inconsistency between * ginHeapTupleFastCollect and ginEntryInsert called by - * ginHeapTupleInsert. ginHeapTupleFastCollect forms tuple without + * ginHeapTupleInsert. ginHeapTupleFastCollect forms tuple without * extra pointer to heap, but ginEntryInsert (called for pending list * cleanup during vacuum) will form the same tuple with one * ItemPointer. diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index 967c02b7983..705d167963b 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.29 2010/01/02 16:57:33 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.30 2010/02/26 02:00:33 momjian Exp $ *------------------------------------------------------------------------- */ @@ -25,11 +25,11 @@ typedef struct pendingPosition { - Buffer pendingBuffer; - OffsetNumber firstOffset; - OffsetNumber lastOffset; - ItemPointerData item; - bool *hasMatchKey; + Buffer pendingBuffer; + OffsetNumber firstOffset; + OffsetNumber lastOffset; + ItemPointerData item; + bool *hasMatchKey; } pendingPosition; @@ -877,7 +877,7 @@ matchPartialInPendingList(GinState *ginstate, Page page, static bool hasAllMatchingKeys(GinScanOpaque so, pendingPosition *pos) { - int i; + int i; for (i = 0; i < so->nkeys; i++) if (pos->hasMatchKey[i] == false) @@ -912,7 +912,7 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos) memset(key->entryRes, FALSE, key->nentries); } - memset(pos->hasMatchKey, FALSE, so->nkeys); + memset(pos->hasMatchKey, FALSE, so->nkeys); for (;;) { |