initCachedPage(buildstate);
- if (BloomPageAddItem(&buildstate->blstate, buildstate->data, itup) == false)
+ if (!BloomPageAddItem(&buildstate->blstate, buildstate->data, itup))
{
/* We shouldn't be here since we're inserting to the empty page */
- elog(ERROR, "can not add new tuple");
+ elog(ERROR, "could not add new bloom tuple to empty page");
}
}
metaData = BloomPageGetMeta(metaPage);
page = GenericXLogRegister(state, buffer, true);
BloomInitPage(page, 0);
- BloomPageAddItem(&blstate, page, itup);
+
+ if (!BloomPageAddItem(&blstate, page, itup))
+ {
+ /* We shouldn't be here since we're inserting to the empty page */
+ elog(ERROR, "could not add new bloom tuple to empty page");
+ }
metaData->nStart = 0;
metaData->nEnd = 1;
* sizeOfBloomTuple is index's specific, and it depends on reloptions, so
* precompute it
*/
- int32 sizeOfBloomTuple;
+ Size sizeOfBloomTuple;
} BloomState;
#define BloomPageGetFreeSpace(state, page) \
typedef struct BloomTuple
{
ItemPointerData heapPtr;
- SignType sign[1];
+ SignType sign[FLEXIBLE_ARRAY_MEMBER];
} BloomTuple;
#define BLOOMTUPLEHDRSZ offsetof(BloomTuple, sign)
BufferAccessStrategy bas;
BloomScanOpaque so = (BloomScanOpaque) scan->opaque;
- if (so->sign == NULL && scan->numberOfKeys > 0)
+ if (so->sign == NULL)
{
/* New search: have to calculate search signature */
ScanKey skey = scan->keyData;
bool res = true;
/* Check index signature with scan signature */
- for (i = 0; res && i < so->state.opts->bloomLength; i++)
+ for (i = 0; i < so->state.opts->bloomLength; i++)
{
if ((itup->sign[i] & so->sign[i]) != so->sign[i])
+ {
res = false;
+ break;
+ }
}
/* Add matching tuples to bitmap */