92 size_t tidstore_max_size = 2 * 1024 * 1024;
93 size_t array_init_size = 1024;
140 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
141 errmsg(
"array must not contain nulls")));
145 (
errcode(ERRCODE_DATA_EXCEPTION),
146 errmsg(
"argument must be empty or one-dimensional array")));
192 for (
int i = 0;
i < noffs;
i++)
224 int num_iter_tids = 0;
225 int num_lookup_tids = 0;
233 elog(
ERROR,
"missing TID with block %u, offset %u",
246 if (
i > 0 && blkno == prevblkno)
275 for (
int i = 0;
i < num_offsets;
i++)
297 elog(
ERROR,
"TID iter array doesn't match verification array, got (%u,%u) expected (%u,%u)",
303 elog(
ERROR,
"TID lookup array doesn't match verification array, got (%u,%u) expected (%u,%u)",
Datum idx(PG_FUNCTION_ARGS)
#define PG_GETARG_ARRAYTYPE_P_COPY(n)
bool array_contains_nulls(ArrayType *array)
int ArrayGetNItems(int ndim, const int *dims)
#define Assert(condition)
void dsa_pin_mapping(dsa_area *area)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_RETURN_INT64(x)
#define PG_GETARG_INT64(n)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_BOOL(x)
static void ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber offNum)
static OffsetNumber ItemPointerGetOffsetNumber(const ItemPointerData *pointer)
static BlockNumber ItemPointerGetBlockNumber(const ItemPointerData *pointer)
struct ItemPointerData ItemPointerData
void LWLockRegisterTranche(int tranche_id, const char *tranche_name)
int LWLockNewTrancheId(void)
void pfree(void *pointer)
MemoryContext TopMemoryContext
void * palloc0(Size size)
void * repalloc(void *pointer, Size size)
#define FirstOffsetNumber
#define qsort(a, b, c, d)
RT_SCOPE RT_RADIX_TREE *MemoryContext old_ctx
MemoryContextSwitchTo(old_ctx)
ItemPointerData * insert_tids
ItemPointerData * lookup_tids
ItemPointerData * iter_tids
struct ItemArray ItemArray
static void sanity_check_array(ArrayType *ta)
static void check_tidstore_available(void)
static int itemptr_cmp(const void *left, const void *right)
PG_FUNCTION_INFO_V1(test_create)
Datum do_set_block_offsets(PG_FUNCTION_ARGS)
Datum test_create(PG_FUNCTION_ARGS)
static TidStore * tidstore
static void purge_from_verification_array(BlockNumber blkno)
Datum check_set_block_offsets(PG_FUNCTION_ARGS)
Datum test_destroy(PG_FUNCTION_ARGS)
Datum test_is_full(PG_FUNCTION_ARGS)
static size_t tidstore_empty_size
void TidStoreEndIterate(TidStoreIter *iter)
TidStoreIterResult * TidStoreIterateNext(TidStoreIter *iter)
void TidStoreLockShare(TidStore *ts)
TidStore * TidStoreCreateShared(size_t max_bytes, int tranche_id)
void TidStoreDestroy(TidStore *ts)
dsa_area * TidStoreGetDSA(TidStore *ts)
void TidStoreUnlock(TidStore *ts)
TidStore * TidStoreCreateLocal(size_t max_bytes, bool insert_only)
bool TidStoreIsMember(TidStore *ts, ItemPointer tid)
int TidStoreGetBlockOffsets(TidStoreIterResult *result, OffsetNumber *offsets, int max_offsets)
TidStoreIter * TidStoreBeginIterate(TidStore *ts)
void TidStoreLockExclusive(TidStore *ts)
void TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets, int num_offsets)
size_t TidStoreMemoryUsage(TidStore *ts)