本文整理汇总了C++中PageSetTLI函数的典型用法代码示例。如果您正苦于以下问题:C++ PageSetTLI函数的具体用法?C++ PageSetTLI怎么用?C++ PageSetTLI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PageSetTLI函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:avontd2868,项目名称:postgres,代码行数:25,代码来源:spgxlog.c
示例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);
}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:36,代码来源:bitmaputil.c
示例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();
}
开发者ID:jaiminpan,项目名称:bizgres,代码行数:37,代码来源:bitmaputil.c
示例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);
}
}
开发者ID:GisKook,项目名称:Gis,代码行数:31,代码来源:gistxlog.c
示例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);
}
开发者ID:charsyam,项目名称:postgres,代码行数:44,代码来源:gistxlog.c
示例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);
}
开发者ID:Aldizh,项目名称:buffer_manager,代码行数:45,代码来源:visibilitymap.c
示例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);
}
}
}
开发者ID:avontd2868,项目名称:postgres,代码行数:31,代码来源:spgxlog.c
示例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();
}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:36,代码来源:gist.c
示例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);
}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:36,代码来源:bitmaputil.c
示例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);
}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:35,代码来源:bitmaputil.c
示例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();
}
开发者ID:ricky-wu,项目名称:gpdb,代码行数:36,代码来源:nbtpage.c
示例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);
}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:48,代码来源:bitmaputil.c
示例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);
}
开发者ID:badalex,项目名称:postgresql-scratchpad,代码行数:59,代码来源:nbtsort.c
示例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();
}
开发者ID:CraigBryan,项目名称:PostgresqlFun,代码行数:65,代码来源:nbtpage.c
示例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();
}
开发者ID:jaiminpan,项目名称:bizgres,代码行数:55,代码来源:bitmaputil.c
示例16: createPostingTree
/*
* Creates posting tree with one page. Function
* suppose that items[] fits to page
*/
static BlockNumber
createPostingTree(Relation index, ItemPointerData *items, uint32 nitems)
{
BlockNumber blkno;
Buffer buffer = GinNewBuffer(index);
Page page;
START_CRIT_SECTION();
GinInitBuffer(buffer, GIN_DATA | GIN_LEAF);
page = BufferGetPage(buffer);
blkno = BufferGetBlockNumber(buffer);
memcpy(GinDataPageGetData(page), items, sizeof(ItemPointerData) * nitems);
GinPageGetOpaque(page)->maxoff = nitems;
MarkBufferDirty(buffer);
if (!index->rd_istemp)
{
XLogRecPtr recptr;
XLogRecData rdata[2];
ginxlogCreatePostingTree data;
data.node = index->rd_node;
data.blkno = blkno;
data.nitem = nitems;
rdata[0].buffer = InvalidBuffer;
rdata[0].data = (char *) &data;
rdata[0].len = sizeof(ginxlogCreatePostingTree);
rdata[0].next = &rdata[1];
rdata[1].buffer = InvalidBuffer;
rdata[1].data = (char *) items;
rdata[1].len = sizeof(ItemPointerData) * nitems;
rdata[1].next = NULL;
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_CREATE_PTREE, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
UnlockReleaseBuffer(buffer);
END_CRIT_SECTION();
return blkno;
}
开发者ID:HBPSP8Repo,项目名称:NoDB,代码行数:56,代码来源:gininsert.c
示例17: _bt_metapinit
/*
* _bt_metapinit() -- Initialize the metadata page of a new btree.
*
* Note: this is actually not used for standard btree index building;
* nbtsort.c prefers not to make the metadata page valid until completion
* of build.
*
* Note: there's no real need for any locking here. Since the transaction
* creating the index hasn't committed yet, no one else can even see the index
* much less be trying to use it. (In a REINDEX-in-place scenario, that's
* not true, but we assume the caller holds sufficient locks on the index.)
*/
void
_bt_metapinit(Relation rel)
{
Buffer buf;
Page pg;
BTMetaPageData *metad;
if (RelationGetNumberOfBlocks(rel) != 0)
elog(ERROR, "cannot initialize non-empty btree index \"%s\"",
RelationGetRelationName(rel));
buf = ReadBuffer(rel, P_NEW);
Assert(BufferGetBlockNumber(buf) == BTREE_METAPAGE);
pg = BufferGetPage(buf);
_bt_initmetapage(pg, P_NONE, 0);
metad = BTPageGetMeta(pg);
/* NO ELOG(ERROR) from here till newmeta op is logged */
START_CRIT_SECTION();
/* XLOG stuff */
if (!rel->rd_istemp)
{
xl_btree_newmeta xlrec;
XLogRecPtr recptr;
XLogRecData rdata[1];
xlrec.node = rel->rd_node;
xlrec.meta.root = metad->btm_root;
xlrec.meta.level = metad->btm_level;
xlrec.meta.fastroot = metad->btm_fastroot;
xlrec.meta.fastlevel = metad->btm_fastlevel;
rdata[0].data = (char *) &xlrec;
rdata[0].len = SizeOfBtreeNewmeta;
rdata[0].buffer = InvalidBuffer;
rdata[0].next = NULL;
recptr = XLogInsert(RM_BTREE_ID,
XLOG_BTREE_NEWMETA,
rdata);
PageSetLSN(pg, recptr);
PageSetTLI(pg, ThisTimeLineID);
}
END_CRIT_SECTION();
WriteBuffer(buf);
}
开发者ID:CraigBryan,项目名称:PostgresqlFun,代码行数:63,代码来源:nbtpage.c
示例18: bitmap_xlog_insert_bitmap_lastwords
static void
bitmap_xlog_insert_bitmap_lastwords(bool redo, XLogRecPtr lsn, XLogRecord* record)
{
xl_bm_bitmap_lastwords *xlrec =
(xl_bm_bitmap_lastwords*) XLogRecGetData(record);
Relation reln;
reln = XLogOpenRelation(xlrec->bm_node);
if (!RelationIsValid(reln))
return;
if (redo)
{
Buffer lovBuffer;
Page lovPage;
BMLOVItem lovItem;
#ifdef BM_DEBUG
ereport(LOG, (errcode(LOG),
errmsg("call bitmap_xlog_insert_bitmap_lastwords: redo=%d\n",
redo)));
#endif
lovBuffer = XLogReadBuffer(false, reln, xlrec->bm_lov_blkno);
if (!BufferIsValid(lovBuffer))
elog(PANIC, "bm_insert_redo: block unfound: %d",
xlrec->bm_lov_blkno);
lovPage = BufferGetPage(lovBuffer);
if (XLByteLT(PageGetLSN(lovPage), lsn))
{
lovItem = (BMLOVItem)
PageGetItem(lovPage, PageGetItemId(lovPage, xlrec->bm_lov_offset));
lovItem->bm_last_compword = xlrec->bm_last_compword;
lovItem->bm_last_word = xlrec->bm_last_word;
lovItem->bm_last_two_headerbits = xlrec->bm_last_two_headerbits;
PageSetLSN(lovPage, lsn);
PageSetTLI(lovPage, ThisTimeLineID);
_bitmap_wrtbuf(lovBuffer);
}
else
_bitmap_relbuf(lovBuffer);
}
else
elog(PANIC, "bm_insert_undo: not implemented.");
}
开发者ID:jaiminpan,项目名称:bizgres,代码行数:51,代码来源:bitmapxlog.c
示例19: lazy_vacuum_page
/*
* lazy_vacuum_page() -- free dead tuples on a page
* and repair its fragmentation.
*
* Caller must hold pin and buffer cleanup lock on the buffer.
*
* tupindex is the index in vacrelstats->dead_tuples of the first dead
* tuple for this page. We assume the rest follow sequentially.
* The return value is the first tupindex after the tuples of this page.
*/
static int
lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
int tupindex, LVRelStats *vacrelstats)
{
OffsetNumber unused[MaxOffsetNumber];
int uncnt;
Page page = BufferGetPage(buffer);
ItemId itemid;
MIRROREDLOCK_BUFMGR_MUST_ALREADY_BE_HELD;
START_CRIT_SECTION();
for (; tupindex < vacrelstats->num_dead_tuples; tupindex++)
{
BlockNumber tblk;
OffsetNumber toff;
tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]);
if (tblk != blkno)
break; /* past end of tuples for this block */
toff = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples[tupindex]);
itemid = PageGetItemId(page, toff);
itemid->lp_flags &= ~LP_USED;
}
uncnt = PageRepairFragmentation(page, unused);
MarkBufferDirty(buffer);
/* XLOG stuff */
if (!onerel->rd_istemp)
{
XLogRecPtr recptr;
recptr = log_heap_clean(onerel, buffer, unused, uncnt);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
else
{
/* No XLOG record, but still need to flag that XID exists on disk */
MyXactMadeTempRelUpdate = true;
}
END_CRIT_SECTION();
return tupindex;
}
开发者ID:craig-chasseur,项目名称:gpdb,代码行数:59,代码来源:vacuumlazy.c
示例20: lazy_vacuum_page
/*
* lazy_vacuum_page() -- free dead tuples on a page
* and repair its fragmentation.
*
* Caller must hold pin and buffer cleanup lock on the buffer.
*
* tupindex is the index in vacrelstats->dead_tuples of the first dead
* tuple for this page. We assume the rest follow sequentially.
* The return value is the first tupindex after the tuples of this page.
*/
static int
lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
int tupindex, LVRelStats *vacrelstats)
{
Page page = BufferGetPage(buffer);
OffsetNumber unused[MaxOffsetNumber];
int uncnt = 0;
MIRROREDLOCK_BUFMGR_MUST_ALREADY_BE_HELD;
START_CRIT_SECTION();
for (; tupindex < vacrelstats->num_dead_tuples; tupindex++)
{
BlockNumber tblk;
OffsetNumber toff;
ItemId itemid;
tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]);
if (tblk != blkno)
break; /* past end of tuples for this block */
toff = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples[tupindex]);
itemid = PageGetItemId(page, toff);
ItemIdSetUnused(itemid);
unused[uncnt++] = toff;
}
PageRepairFragmentation(page);
MarkBufferDirty(buffer);
/* XLOG stuff */
if (!onerel->rd_istemp)
{
XLogRecPtr recptr;
recptr = log_heap_clean(onerel, buffer,
NULL, 0, NULL, 0,
unused, uncnt,
false);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
return tupindex;
}
开发者ID:Mrfuture1,项目名称:gpdb,代码行数:58,代码来源:vacuumlazy.c
注:本文中的PageSetTLI函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论