本文整理汇总了C++中PageSetTLI函数的典型用法代码示例。如果您正苦于以下问题:C++ PageSetTLI函数的具体用法?C++ PageSetTLI怎么用?C++ PageSetTLI使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PageSetTLI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spgRedoCreateIndex
static void
spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
{
RelFileNode *node = (RelFileNode *) XLogRecGetData(record);
Buffer buffer;
Page page;
buffer = XLogReadBuffer(*node, SPGIST_METAPAGE_BLKNO, true);
Assert(BufferIsValid(buffer));
page = (Page) BufferGetPage(buffer);
SpGistInitMetapage(page);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
buffer = XLogReadBuffer(*node, SPGIST_HEAD_BLKNO, true);
Assert(BufferIsValid(buffer));
SpGistInitBuffer(buffer, SPGIST_LEAF);
page = (Page) BufferGetPage(buffer);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
示例2: _bitmap_log_bitmap_lastwords
/*
* _bitmap_log_bitmap_lastwords() -- log the last two words in a bitmap.
*/
void
_bitmap_log_bitmap_lastwords(Relation rel, Buffer lovBuffer,
OffsetNumber lovOffset, BMLOVItem lovItem)
{
xl_bm_bitmap_lastwords xlLastwords;
XLogRecPtr recptr;
XLogRecData rdata[1];
// Fetch gp_persistent_relation_node information that will be added to XLOG record.
RelationFetchGpRelationNodeForXLog(rel);
xlLastwords.bm_node = rel->rd_node;
xlLastwords.bm_persistentTid = rel->rd_relationnodeinfo.persistentTid;
xlLastwords.bm_persistentSerialNum = rel->rd_relationnodeinfo.persistentSerialNum;
xlLastwords.bm_last_compword = lovItem->bm_last_compword;
xlLastwords.bm_last_word = lovItem->bm_last_word;
xlLastwords.lov_words_header = lovItem->lov_words_header;
xlLastwords.bm_last_setbit = lovItem->bm_last_setbit;
xlLastwords.bm_last_tid_location = lovItem->bm_last_tid_location;
xlLastwords.bm_lov_blkno = BufferGetBlockNumber(lovBuffer);
xlLastwords.bm_lov_offset = lovOffset;
rdata[0].buffer = InvalidBuffer;
rdata[0].data = (char*)&xlLastwords;
rdata[0].len = sizeof(xl_bm_bitmap_lastwords);
rdata[0].next = NULL;
recptr = XLogInsert(RM_BITMAP_ID, XLOG_BITMAP_INSERT_BITMAP_LASTWORDS,
rdata);
PageSetLSN(BufferGetPage(lovBuffer), recptr);
PageSetTLI(BufferGetPage(lovBuffer), ThisTimeLineID);
}
示例3: _bitmap_log_metapage
/*
* _bitmap_log_metapage() -- log the changes to the metapage
*/
void
_bitmap_log_metapage(Relation rel, BMMetaPage metapage)
{
/* XLOG stuff */
START_CRIT_SECTION();
if (!(rel->rd_istemp))
{
xl_bm_metapage* xlMeta;
XLogRecPtr recptr;
XLogRecData rdata[1];
#ifdef BM_DEBUG
elog(LOG, "call _bitmap_log_metapage.");
#endif
xlMeta = (xl_bm_metapage*)
palloc(MAXALIGN(sizeof(xl_bm_metapage)));
xlMeta->bm_node = rel->rd_node;
rdata[0].buffer = InvalidBuffer;
rdata[0].data = (char*)xlMeta;
rdata[0].len = MAXALIGN(sizeof(xl_bm_metapage));
rdata[0].next = NULL;
recptr = XLogInsert(RM_BITMAP_ID, XLOG_BITMAP_INSERT_META, rdata);
PageSetLSN(metapage, recptr);
PageSetTLI(metapage, ThisTimeLineID);
pfree(xlMeta);
}
END_CRIT_SECTION();
}
示例4: gistRedoClearFollowRight
/*
* Replay the clearing of F_FOLLOW_RIGHT flag.
*/
static void
gistRedoClearFollowRight(RelFileNode node, XLogRecPtr lsn,
BlockNumber leftblkno)
{
Buffer buffer;
buffer = XLogReadBuffer(node, leftblkno, false);
if (BufferIsValid(buffer))
{
Page page = (Page) BufferGetPage(buffer);
/*
* Note that we still update the page even if page LSN is equal to the
* LSN of this record, because the updated NSN is not included in the
* full page image.
*/
if (!XLByteLT(lsn, PageGetLSN(page)))
{
GistPageGetOpaque(page)->nsn = lsn;
GistClearFollowRight(page);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
}
}
示例5: gistRedoClearFollowRight
/*
* Replay the clearing of F_FOLLOW_RIGHT flag on a child page.
*
* Even if the WAL record includes a full-page image, we have to update the
* follow-right flag, because that change is not included in the full-page
* image. To be sure that the intermediate state with the wrong flag value is
* not visible to concurrent Hot Standby queries, this function handles
* restoring the full-page image as well as updating the flag. (Note that
* we never need to do anything else to the child page in the current WAL
* action.)
*/
static void
gistRedoClearFollowRight(XLogRecPtr lsn, XLogRecord *record, int block_index,
RelFileNode node, BlockNumber childblkno)
{
Buffer buffer;
Page page;
if (record->xl_info & XLR_BKP_BLOCK(block_index))
buffer = RestoreBackupBlock(lsn, record, block_index, false, true);
else
{
buffer = XLogReadBuffer(node, childblkno, false);
if (!BufferIsValid(buffer))
return; /* page was deleted, nothing to do */
}
page = (Page) BufferGetPage(buffer);
/*
* Note that we still update the page even if page LSN is equal to the LSN
* of this record, because the updated NSN is not included in the full
* page image.
*/
if (lsn >= PageGetLSN(page))
{
GistPageSetNSN(page, lsn);
GistClearFollowRight(page);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
}
示例6: visibilitymap_set
/*
* visibilitymap_set - set a bit on a previously pinned page
*
* recptr is the LSN of the heap page. The LSN of the visibility map page is
* advanced to that, to make sure that the visibility map doesn't get flushed
* to disk before the update to the heap page that made all tuples visible.
*
* This is an opportunistic function. It does nothing, unless *buf
* contains the bit for heapBlk. Call visibilitymap_pin first to pin
* the right map page. This function doesn't do any I/O.
*/
void
visibilitymap_set(Relation rel, BlockNumber heapBlk, XLogRecPtr recptr,
Buffer *buf)
{
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK(heapBlk);
uint32 mapByte = HEAPBLK_TO_MAPBYTE(heapBlk);
uint8 mapBit = HEAPBLK_TO_MAPBIT(heapBlk);
Page page;
char *map;
#ifdef TRACE_VISIBILITYMAP
elog(DEBUG1, "vm_set %s %d", RelationGetRelationName(rel), heapBlk);
#endif
/* Check that we have the right page pinned */
if (!BufferIsValid(*buf) || BufferGetBlockNumber(*buf) != mapBlock)
return;
page = BufferGetPage(*buf);
map = PageGetContents(page);
LockBuffer(*buf, BUFFER_LOCK_EXCLUSIVE);
if (!(map[mapByte] & (1 << mapBit)))
{
map[mapByte] |= (1 << mapBit);
if (XLByteLT(PageGetLSN(page), recptr))
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(*buf);
}
LockBuffer(*buf, BUFFER_LOCK_UNLOCK);
}
示例7: spgRedoVacuumRoot
static void
spgRedoVacuumRoot(XLogRecPtr lsn, XLogRecord *record)
{
char *ptr = XLogRecGetData(record);
spgxlogVacuumRoot *xldata = (spgxlogVacuumRoot *) ptr;
OffsetNumber *toDelete;
Buffer buffer;
Page page;
ptr += sizeof(spgxlogVacuumRoot);
toDelete = (OffsetNumber *) ptr;
if (!(record->xl_info & XLR_BKP_BLOCK_1))
{
buffer = XLogReadBuffer(xldata->node, SPGIST_HEAD_BLKNO, false);
if (BufferIsValid(buffer))
{
page = BufferGetPage(buffer);
if (!XLByteLE(lsn, PageGetLSN(page)))
{
/* The tuple numbers are in order */
PageIndexMultiDelete(page, toDelete, xldata->nDelete);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
}
}
}
示例8: gistnewroot
/*
* buffer must be pinned and locked by caller
*/
void
gistnewroot(Relation r, Buffer buffer, IndexTuple *itup, int len, ItemPointer key)
{
Page page;
Assert(BufferGetBlockNumber(buffer) == GIST_ROOT_BLKNO);
page = BufferGetPage(buffer);
START_CRIT_SECTION();
GISTInitBuffer(buffer, 0);
gistfillbuffer(r, page, itup, len, FirstOffsetNumber);
MarkBufferDirty(buffer);
if (!r->rd_istemp)
{
XLogRecPtr recptr;
XLogRecData *rdata;
rdata = formUpdateRdata(r, buffer,
NULL, 0,
itup, len, key);
recptr = XLogInsert(RM_GIST_ID, XLOG_GIST_NEW_ROOT, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
else
PageSetLSN(page, XLogRecPtrForTemp);
END_CRIT_SECTION();
}
示例9: _bitmap_log_newpage
/*
* _bitmap_log_newpage() -- log a new page.
*
* This function is called before writing a new buffer.
*/
void
_bitmap_log_newpage(Relation rel, uint8 info, Buffer buf)
{
Page page;
xl_bm_newpage xlNewPage;
XLogRecPtr recptr;
XLogRecData rdata[1];
page = BufferGetPage(buf);
// Fetch gp_persistent_relation_node information that will be added to XLOG record.
RelationFetchGpRelationNodeForXLog(rel);
xlNewPage.bm_node = rel->rd_node;
xlNewPage.bm_persistentTid = rel->rd_relationnodeinfo.persistentTid;
xlNewPage.bm_persistentSerialNum = rel->rd_relationnodeinfo.persistentSerialNum;
xlNewPage.bm_new_blkno = BufferGetBlockNumber(buf);
elog(DEBUG1, "_bitmap_log_newpage: blkno=%d", xlNewPage.bm_new_blkno);
rdata[0].buffer = InvalidBuffer;
rdata[0].data = (char *)&xlNewPage;
rdata[0].len = sizeof(xl_bm_newpage);
rdata[0].next = NULL;
recptr = XLogInsert(RM_BITMAP_ID, info, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
示例10: _bitmap_log_metapage
/*
* _bitmap_log_metapage() -- log the changes to the metapage
*/
void
_bitmap_log_metapage(Relation rel, Page page)
{
BMMetaPage metapage = (BMMetaPage) PageGetContents(page);
xl_bm_metapage* xlMeta;
XLogRecPtr recptr;
XLogRecData rdata[1];
// Fetch gp_persistent_relation_node information that will be added to XLOG record.
RelationFetchGpRelationNodeForXLog(rel);
xlMeta = (xl_bm_metapage *)
palloc(MAXALIGN(sizeof(xl_bm_metapage)));
xlMeta->bm_node = rel->rd_node;
xlMeta->bm_persistentTid = rel->rd_relationnodeinfo.persistentTid;
xlMeta->bm_persistentSerialNum = rel->rd_relationnodeinfo.persistentSerialNum;
xlMeta->bm_lov_heapId = metapage->bm_lov_heapId;
xlMeta->bm_lov_indexId = metapage->bm_lov_indexId;
xlMeta->bm_lov_lastpage = metapage->bm_lov_lastpage;
rdata[0].buffer = InvalidBuffer;
rdata[0].data = (char*)xlMeta;
rdata[0].len = MAXALIGN(sizeof(xl_bm_metapage));
rdata[0].next = NULL;
recptr = XLogInsert(RM_BITMAP_ID, XLOG_BITMAP_INSERT_META, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
pfree(xlMeta);
}
示例11: _bt_lognewpage
/*
* _bt_lognewpage() -- create an XLOG entry for a new page of the btree.
*/
void
_bt_lognewpage(Relation index,
Page newPage,
BlockNumber blockNo)
{
/* We use the heap NEWPAGE record type for this */
xl_heap_newpage xlrec;
XLogRecPtr recptr;
XLogRecData rdata[2];
/* NO ELOG(ERROR) from here till newpage op is logged */
START_CRIT_SECTION();
xl_heapnode_set(&xlrec.heapnode, index);
xlrec.blkno = blockNo;
rdata[0].data = (char *) &xlrec;
rdata[0].len = SizeOfHeapNewpage;
rdata[0].buffer = InvalidBuffer;
rdata[0].next = &(rdata[1]);
rdata[1].data = (char *) newPage;
rdata[1].len = BLCKSZ;
rdata[1].buffer = InvalidBuffer;
rdata[1].next = NULL;
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_NEWPAGE, rdata);
PageSetLSN(newPage, recptr);
PageSetTLI(newPage, ThisTimeLineID);
END_CRIT_SECTION();
}
示例12: _bitmap_log_lovitem
/*
* _bitmap_log_lovitem() -- log adding a new lov item to a lov page.
*/
void
_bitmap_log_lovitem(Relation rel, Buffer lovBuffer, OffsetNumber offset,
BMLOVItem lovItem, Buffer metabuf, bool is_new_lov_blkno)
{
Page lovPage = BufferGetPage(lovBuffer);
xl_bm_lovitem xlLovItem;
XLogRecPtr recptr;
XLogRecData rdata[1];
// Fetch gp_persistent_relation_node information that will be added to XLOG record.
RelationFetchGpRelationNodeForXLog(rel);
Assert(BufferGetBlockNumber(lovBuffer) > 0);
xlLovItem.bm_node = rel->rd_node;
xlLovItem.bm_persistentTid = rel->rd_relationnodeinfo.persistentTid;
xlLovItem.bm_persistentSerialNum = rel->rd_relationnodeinfo.persistentSerialNum;
xlLovItem.bm_lov_blkno = BufferGetBlockNumber(lovBuffer);
xlLovItem.bm_lov_offset = offset;
memcpy(&(xlLovItem.bm_lovItem), lovItem, sizeof(BMLOVItemData));
xlLovItem.bm_is_new_lov_blkno = is_new_lov_blkno;
rdata[0].buffer = InvalidBuffer;
rdata[0].data = (char*)&xlLovItem;
rdata[0].len = sizeof(xl_bm_lovitem);
rdata[0].next = NULL;
recptr = XLogInsert(RM_BITMAP_ID,
XLOG_BITMAP_INSERT_LOVITEM, rdata);
if (is_new_lov_blkno)
{
Page metapage = BufferGetPage(metabuf);
PageSetLSN(metapage, recptr);
PageSetTLI(metapage, ThisTimeLineID);
}
PageSetLSN(lovPage, recptr);
PageSetTLI(lovPage, ThisTimeLineID);
elog(DEBUG1, "Insert a new lovItem at (blockno, offset): (%d,%d)",
BufferGetBlockNumber(lovBuffer), offset);
}
示例13: _bt_blwritepage
/*
* emit a completed btree page, and release the working storage.
*/
static void
_bt_blwritepage(BTWriteState *wstate, Page page, BlockNumber blkno)
{
/* Ensure rd_smgr is open (could have been closed by relcache flush!) */
RelationOpenSmgr(wstate->index);
/* XLOG stuff */
if (wstate->btws_use_wal)
{
/* We use the heap NEWPAGE record type for this */
log_newpage(&wstate->index->rd_node, MAIN_FORKNUM, blkno, page);
}
else
{
/* Leave the page LSN zero if not WAL-logged, but set TLI anyway */
PageSetTLI(page, ThisTimeLineID);
}
/*
* If we have to write pages nonsequentially, fill in the space with
* zeroes until we come back and overwrite. This is not logically
* necessary on standard Unix filesystems (unwritten space will read as
* zeroes anyway), but it should help to avoid fragmentation. The dummy
* pages aren't WAL-logged though.
*/
while (blkno > wstate->btws_pages_written)
{
if (!wstate->btws_zeropage)
wstate->btws_zeropage = (Page) palloc0(BLCKSZ);
smgrextend(wstate->index->rd_smgr, MAIN_FORKNUM,
wstate->btws_pages_written++,
(char *) wstate->btws_zeropage,
true);
}
/*
* Now write the page. We say isTemp = true even if it's not a temp
* index, because there's no need for smgr to schedule an fsync for this
* write; we'll do it ourselves before ending the build.
*/
if (blkno == wstate->btws_pages_written)
{
/* extending the file... */
smgrextend(wstate->index->rd_smgr, MAIN_FORKNUM, blkno,
(char *) page, true);
wstate->btws_pages_written++;
}
else
{
/* overwriting a block we zero-filled before */
smgrwrite(wstate->index->rd_smgr, MAIN_FORKNUM, blkno,
(char *) page, true);
}
pfree(page);
}
示例14: _bt_delitems
/*
* Delete item(s) from a btree page.
*
* This must only be used for deleting leaf items. Deleting an item on a
* non-leaf page has to be done as part of an atomic action that includes
* deleting the page it points to.
*
* This routine assumes that the caller has pinned and locked the buffer,
* and will write the buffer afterwards. Also, the given itemnos *must*
* appear in increasing order in the array.
*/
void
_bt_delitems(Relation rel, Buffer buf,
OffsetNumber *itemnos, int nitems)
{
Page page = BufferGetPage(buf);
/* No ereport(ERROR) until changes are logged */
START_CRIT_SECTION();
/* Fix the page */
PageIndexMultiDelete(page, itemnos, nitems);
/* XLOG stuff */
if (!rel->rd_istemp)
{
xl_btree_delete xlrec;
XLogRecPtr recptr;
XLogRecData rdata[2];
xlrec.node = rel->rd_node;
xlrec.block = BufferGetBlockNumber(buf);
rdata[0].data = (char *) &xlrec;
rdata[0].len = SizeOfBtreeDelete;
rdata[0].buffer = InvalidBuffer;
rdata[0].next = &(rdata[1]);
/*
* The target-offsets array is not in the buffer, but pretend that it
* is. When XLogInsert stores the whole buffer, the offsets array
* need not be stored too.
*/
if (nitems > 0)
{
rdata[1].data = (char *) itemnos;
rdata[1].len = nitems * sizeof(OffsetNumber);
}
else
{
rdata[1].data = NULL;
rdata[1].len = 0;
}
rdata[1].buffer = buf;
rdata[1].buffer_std = true;
rdata[1].next = NULL;
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_DELETE, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
}
示例15: _bitmap_log_lovmetapage
/*
* _bitmap_log_lovmetapage() -- log the lov meta page.
*/
void
_bitmap_log_lovmetapage(Relation rel, Buffer lovMetaBuffer, uint8 numOfAttrs)
{
Page lovMetapage;
BMLOVMetaItem metaItems;
lovMetapage = BufferGetPage(lovMetaBuffer);
metaItems = (BMLOVMetaItem)PageGetContents(lovMetapage);
/* XLOG stuff */
START_CRIT_SECTION();
if (!(rel->rd_istemp))
{
BMLOVMetaItem copyMetaItems;
XLogRecPtr recptr;
XLogRecData rdata[1];
xl_bm_lovmetapage* xlLovMeta;
#ifdef BM_DEBUG
elog(LOG, "call _bitmap_log_lovmetapage: numOfAttrs=%d", numOfAttrs);
#endif
xlLovMeta = (xl_bm_lovmetapage*)
palloc(sizeof(xl_bm_lovmetapage)+
numOfAttrs*sizeof(BMLOVMetaItemData));
xlLovMeta->bm_node = rel->rd_node;
xlLovMeta->bm_num_of_attrs = numOfAttrs;
copyMetaItems = (BMLOVMetaItem)
(((char*)xlLovMeta) + sizeof(xl_bm_lovmetapage));
memcpy(copyMetaItems, metaItems, numOfAttrs*sizeof(BMLOVMetaItemData));
rdata[0].buffer = InvalidBuffer;
rdata[0].data = (char*)xlLovMeta;
rdata[0].len =
sizeof(xl_bm_lovmetapage) + numOfAttrs*sizeof(BMLOVMetaItemData);
rdata[0].next = NULL;
recptr = XLogInsert(RM_BITMAP_ID,
XLOG_BITMAP_INSERT_LOVMETA, rdata);
PageSetLSN(lovMetapage, recptr);
PageSetTLI(lovMetapage, ThisTimeLineID);
pfree(xlLovMeta);
}
END_CRIT_SECTION();
}