28 #define BrinMaxItemSize \
29 MAXALIGN_DOWN(BLCKSZ - \
30 (MAXALIGN(SizeOfPageHeaderData + \
31 sizeof(ItemIdData)) + \
32 MAXALIGN(sizeof(BrinSpecialSpace))))
74 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
75 errmsg(
"index row size %zu exceeds maximum %zu for index \"%s\"",
180 elog(
ERROR,
"failed to replace BRIN tuple");
256 elog(
ERROR,
"failed to add BRIN tuple to new page");
326 ((newsz <= origsz) ||
360 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
361 errmsg(
"index row size %zu exceeds maximum %zu for index \"%s\"",
414 elog(
ERROR,
"failed to add BRIN tuple to new page");
596 buf, off, tup, sz, tup, sz,
false))
720 bool extensionLockHeld =
false;
740 extensionLockHeld =
true;
749 else if (newblk == oldblk)
786 if (extensionLockHeld)
804 if (extensionLockHeld)
815 freespace = *extended ?
817 if (freespace >= itemsz)
850 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
851 errmsg(
"index row size %zu exceeds maximum %zu for index \"%s\"",
856 if (newblk != oldblk)
889 "brin_initialize_empty_new_buffer: initializing blank page %u",
#define InvalidBlockNumber
#define BRIN_IS_META_PAGE(page)
#define BrinPageFlags(page)
#define BRIN_EVACUATE_PAGE
#define BRIN_PAGETYPE_REGULAR
#define BRIN_PAGETYPE_META
#define BRIN_IS_REVMAP_PAGE(page)
#define BrinPageType(page)
#define BRIN_IS_REGULAR_PAGE(page)
void brin_evacuate_page(Relation idxRel, BlockNumber pagesPerRange, BrinRevmap *revmap, Buffer buf)
bool brin_start_evacuating_page(Relation idxRel, Buffer buf)
bool brin_doupdate(Relation idxrel, BlockNumber pagesPerRange, BrinRevmap *revmap, BlockNumber heapBlk, Buffer oldbuf, OffsetNumber oldoff, const BrinTuple *origtup, Size origsz, const BrinTuple *newtup, Size newsz, bool samepage)
static void brin_initialize_empty_new_buffer(Relation idxrel, Buffer buffer)
void brin_page_cleanup(Relation idxrel, Buffer buf)
OffsetNumber brin_doinsert(Relation idxrel, BlockNumber pagesPerRange, BrinRevmap *revmap, Buffer *buffer, BlockNumber heapBlk, BrinTuple *tup, Size itemsz)
void brin_page_init(Page page, uint16 type)
static Size br_page_get_freespace(Page page)
static Buffer brin_getinsertbuffer(Relation irel, Buffer oldbuf, Size itemsz, bool *extended)
void brin_metapage_init(Page page, BlockNumber pagesPerRange, uint16 version)
bool brin_can_do_samepage_update(Buffer buffer, Size origsz, Size newsz)
void brinRevmapExtend(BrinRevmap *revmap, BlockNumber heapBlk)
void brinSetHeapBlockItemptr(Buffer buf, BlockNumber pagesPerRange, BlockNumber heapBlk, ItemPointerData tid)
Buffer brinLockRevmapPageForUpdate(BrinRevmap *revmap, BlockNumber heapBlk)
BrinTuple * brin_copy_tuple(BrinTuple *tuple, Size len, BrinTuple *dest, Size *destsz)
bool brin_tuples_equal(const BrinTuple *a, Size alen, const BrinTuple *b, Size blen)
#define XLOG_BRIN_SAMEPAGE_UPDATE
#define SizeOfBrinSamepageUpdate
#define XLOG_BRIN_INIT_PAGE
BlockNumber BufferGetBlockNumber(Buffer buffer)
void ReleaseBuffer(Buffer buffer)
void UnlockReleaseBuffer(Buffer buffer)
void MarkBufferDirty(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
void MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
#define BUFFER_LOCK_UNLOCK
#define BUFFER_LOCK_SHARE
static Page BufferGetPage(Buffer buffer)
#define BUFFER_LOCK_EXCLUSIVE
static bool BufferIsValid(Buffer bufnum)
bool PageIndexTupleOverwrite(Page page, OffsetNumber offnum, Item newtup, Size newsize)
void PageInit(Page page, Size pageSize, Size specialSize)
void PageIndexTupleDeleteNoCompact(Page page, OffsetNumber offnum)
Size PageGetExactFreeSpace(Page page)
Size PageGetFreeSpace(Page page)
PageHeaderData * PageHeader
static char * PageGetContents(Page page)
static Item PageGetItem(Page page, ItemId itemId)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static bool PageIsNew(Page page)
static void PageSetLSN(Page page, XLogRecPtr lsn)
static OffsetNumber PageGetMaxOffsetNumber(Page page)
#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap)
#define unconstify(underlying_type, expr)
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void FreeSpaceMapVacuumRange(Relation rel, BlockNumber start, BlockNumber end)
BlockNumber RecordAndGetPageWithFreeSpace(Relation rel, BlockNumber oldPage, Size oldSpaceAvail, Size spaceNeeded)
void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, Size spaceAvail)
BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded)
#define ItemIdGetLength(itemId)
#define ItemIdIsNormal(itemId)
#define ItemIdIsUsed(itemId)
static void ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber offNum)
void LockRelationForExtension(Relation relation, LOCKMODE lockmode)
void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode)
#define START_CRIT_SECTION()
#define CHECK_FOR_INTERRUPTS()
#define END_CRIT_SECTION()
#define InvalidOffsetNumber
#define FirstOffsetNumber
#define RELATION_IS_LOCAL(relation)
#define RelationGetRelationName(relation)
#define RelationGetTargetBlock(relation)
#define RelationNeedsWAL(relation)
#define RelationSetTargetBlock(relation, targblock)
BlockNumber lastRevmapPage
BlockNumber pagesPerRange
BlockNumber pagesPerRange
void XLogRegisterBufData(uint8 block_id, const char *data, uint32 len)
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
void XLogRegisterData(const char *data, uint32 len)
XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std)
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
void XLogBeginInsert(void)