PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/brin_page.h"
#include "access/brin_pageops.h"
#include "access/brin_revmap.h"
#include "access/brin_tuple.h"
#include "access/brin_xlog.h"
#include "access/rmgr.h"
#include "access/xloginsert.h"
#include "miscadmin.h"
#include "storage/bufmgr.h"
#include "utils/rel.h"
Go to the source code of this file.
Data Structures | |
struct | BrinRevmap |
Macros | |
#define | HEAPBLK_TO_REVMAP_BLK(pagesPerRange, heapBlk) ((heapBlk / pagesPerRange) / REVMAP_PAGE_MAXITEMS) |
#define | HEAPBLK_TO_REVMAP_INDEX(pagesPerRange, heapBlk) ((heapBlk / pagesPerRange) % REVMAP_PAGE_MAXITEMS) |
Functions | |
static BlockNumber | revmap_get_blkno (BrinRevmap *revmap, BlockNumber heapBlk) |
static Buffer | revmap_get_buffer (BrinRevmap *revmap, BlockNumber heapBlk) |
static BlockNumber | revmap_extend_and_get_blkno (BrinRevmap *revmap, BlockNumber heapBlk) |
static void | revmap_physical_extend (BrinRevmap *revmap) |
BrinRevmap * | brinRevmapInitialize (Relation idxrel, BlockNumber *pagesPerRange) |
void | brinRevmapTerminate (BrinRevmap *revmap) |
void | brinRevmapExtend (BrinRevmap *revmap, BlockNumber heapBlk) |
Buffer | brinLockRevmapPageForUpdate (BrinRevmap *revmap, BlockNumber heapBlk) |
void | brinSetHeapBlockItemptr (Buffer buf, BlockNumber pagesPerRange, BlockNumber heapBlk, ItemPointerData tid) |
BrinTuple * | brinGetTupleForHeapBlock (BrinRevmap *revmap, BlockNumber heapBlk, Buffer *buf, OffsetNumber *off, Size *size, int mode) |
bool | brinRevmapDesummarizeRange (Relation idxrel, BlockNumber heapBlk) |
#define HEAPBLK_TO_REVMAP_BLK | ( | pagesPerRange, | |
heapBlk | |||
) | ((heapBlk / pagesPerRange) / REVMAP_PAGE_MAXITEMS) |
Definition at line 40 of file brin_revmap.c.
#define HEAPBLK_TO_REVMAP_INDEX | ( | pagesPerRange, | |
heapBlk | |||
) | ((heapBlk / pagesPerRange) % REVMAP_PAGE_MAXITEMS) |
Definition at line 42 of file brin_revmap.c.
BrinTuple* brinGetTupleForHeapBlock | ( | BrinRevmap * | revmap, |
BlockNumber | heapBlk, | ||
Buffer * | buf, | ||
OffsetNumber * | off, | ||
Size * | size, | ||
int | mode | ||
) |
Definition at line 194 of file brin_revmap.c.
References Assert, BRIN_IS_REGULAR_PAGE, BrinTuple::bt_blkno, buf, BUFFER_LOCK_SHARE, BUFFER_LOCK_UNLOCK, BufferGetBlockNumber(), BufferGetPage(), BufferIsValid(), CHECK_FOR_INTERRUPTS, ereport, errcode(), errmsg_internal(), ERROR, HEAPBLK_TO_REVMAP_INDEX, InvalidBlockNumber, InvalidBuffer, InvalidOffsetNumber, ItemIdGetLength, ItemIdIsUsed, ItemPointerEquals(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), ItemPointerIsValid(), ItemPointerSetInvalid(), LockBuffer(), mode, PageGetContents(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), ReadBuffer(), ReleaseBuffer(), revmap_get_blkno(), BrinRevmap::rm_currBuf, BrinRevmap::rm_irel, BrinRevmap::rm_pagesPerRange, RevmapContents::rm_tids, and size.
Referenced by bringetbitmap(), brininsert(), brinsummarize(), and summarize_range().
Buffer brinLockRevmapPageForUpdate | ( | BrinRevmap * | revmap, |
BlockNumber | heapBlk | ||
) |
Definition at line 134 of file brin_revmap.c.
References BUFFER_LOCK_EXCLUSIVE, LockBuffer(), and revmap_get_buffer().
Referenced by brin_doinsert(), brin_doupdate(), and brinRevmapDesummarizeRange().
bool brinRevmapDesummarizeRange | ( | Relation | idxrel, |
BlockNumber | heapBlk | ||
) |
Definition at line 323 of file brin_revmap.c.
References BlockNumberIsValid(), BRIN_IS_REGULAR_PAGE, brinLockRevmapPageForUpdate(), brinRevmapInitialize(), brinRevmapTerminate(), brinSetHeapBlockItemptr(), BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetPage(), END_CRIT_SECTION, ereport, errcode(), errmsg(), ERROR, xl_brin_desummarize::heapBlk, HEAPBLK_TO_REVMAP_INDEX, ItemIdIsUsed, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), ItemPointerIsValid(), ItemPointerSetInvalid(), LockBuffer(), MarkBufferDirty(), PageGetContents(), PageGetItemId(), PageGetMaxOffsetNumber(), PageIndexTupleDeleteNoCompact(), PageSetLSN(), xl_brin_desummarize::pagesPerRange, ReadBuffer(), REGBUF_STANDARD, xl_brin_desummarize::regOffset, RelationNeedsWAL, revmap_get_blkno(), BrinRevmap::rm_pagesPerRange, RevmapContents::rm_tids, SizeOfBrinDesummarize, START_CRIT_SECTION, UnlockReleaseBuffer(), XLOG_BRIN_DESUMMARIZE, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by brin_desummarize_range().
void brinRevmapExtend | ( | BrinRevmap * | revmap, |
BlockNumber | heapBlk | ||
) |
Definition at line 112 of file brin_revmap.c.
References Assert, BRIN_METAPAGE_BLKNO, InvalidBlockNumber, PG_USED_FOR_ASSERTS_ONLY, and revmap_extend_and_get_blkno().
Referenced by brin_doinsert(), and brin_doupdate().
BrinRevmap* brinRevmapInitialize | ( | Relation | idxrel, |
BlockNumber * | pagesPerRange | ||
) |
Definition at line 70 of file brin_revmap.c.
References BRIN_METAPAGE_BLKNO, BUFFER_LOCK_SHARE, BUFFER_LOCK_UNLOCK, BufferGetPage(), InvalidBuffer, BrinMetaPageData::lastRevmapPage, LockBuffer(), PageGetContents(), BrinMetaPageData::pagesPerRange, palloc(), ReadBuffer(), BrinRevmap::rm_currBuf, BrinRevmap::rm_irel, BrinRevmap::rm_lastRevmapPage, BrinRevmap::rm_metaBuf, and BrinRevmap::rm_pagesPerRange.
Referenced by brinbeginscan(), brinbuild(), brinRevmapDesummarizeRange(), brinsummarize(), and initialize_brin_insertstate().
void brinRevmapTerminate | ( | BrinRevmap * | revmap | ) |
Definition at line 100 of file brin_revmap.c.
References InvalidBuffer, pfree(), ReleaseBuffer(), BrinRevmap::rm_currBuf, and BrinRevmap::rm_metaBuf.
Referenced by brinbuild(), brinendscan(), brininsertcleanup(), brinRevmapDesummarizeRange(), and brinsummarize().
void brinSetHeapBlockItemptr | ( | Buffer | buf, |
BlockNumber | pagesPerRange, | ||
BlockNumber | heapBlk, | ||
ItemPointerData | tid | ||
) |
Definition at line 155 of file brin_revmap.c.
References buf, BufferGetPage(), HEAPBLK_TO_REVMAP_INDEX, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), ItemPointerIsValid(), ItemPointerSet(), ItemPointerSetInvalid(), PageGetContents(), and RevmapContents::rm_tids.
Referenced by brin_doinsert(), brin_doupdate(), brin_xlog_desummarize_page(), brin_xlog_insert_update(), and brinRevmapDesummarizeRange().
|
static |
Definition at line 500 of file brin_revmap.c.
References CHECK_FOR_INTERRUPTS, HEAPBLK_TO_REVMAP_BLK, revmap_physical_extend(), BrinRevmap::rm_lastRevmapPage, and BrinRevmap::rm_pagesPerRange.
Referenced by brinRevmapExtend().
|
static |
Definition at line 442 of file brin_revmap.c.
References HEAPBLK_TO_REVMAP_BLK, InvalidBlockNumber, and BrinRevmap::rm_pagesPerRange.
Referenced by brinGetTupleForHeapBlock(), brinRevmapDesummarizeRange(), and revmap_get_buffer().
|
static |
Definition at line 463 of file brin_revmap.c.
References Assert, BRIN_METAPAGE_BLKNO, BufferGetBlockNumber(), elog, ERROR, InvalidBlockNumber, InvalidBuffer, ReadBuffer(), ReleaseBuffer(), revmap_get_blkno(), BrinRevmap::rm_currBuf, and BrinRevmap::rm_irel.
Referenced by brinLockRevmapPageForUpdate().
|
static |
Definition at line 522 of file brin_revmap.c.
References BMR_REL, brin_evacuate_page(), BRIN_IS_REGULAR_PAGE, brin_page_init(), BRIN_PAGETYPE_REVMAP, brin_start_evacuating_page(), BrinPageType, buf, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetBlockNumber(), BufferGetPage(), EB_LOCK_FIRST, END_CRIT_SECTION, ereport, errcode(), errmsg(), ERROR, ExtendBufferedRel(), BrinMetaPageData::lastRevmapPage, LockBuffer(), MAIN_FORKNUM, MarkBufferDirty(), PageGetContents(), PageIsNew(), PageSetLSN(), ReadBuffer(), REGBUF_STANDARD, REGBUF_WILL_INIT, RelationGetNumberOfBlocks, RelationGetRelationName, RelationNeedsWAL, BrinRevmap::rm_irel, BrinRevmap::rm_lastRevmapPage, BrinRevmap::rm_metaBuf, BrinRevmap::rm_pagesPerRange, SizeOfBrinRevmapExtend, START_CRIT_SECTION, xl_brin_revmap_extend::targetBlk, UnlockReleaseBuffer(), XLOG_BRIN_REVMAP_EXTEND, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by revmap_extend_and_get_blkno().