Remove PageSetTLI and rename pd_tli to pd_checksum
Remove use of PageSetTLI() from all page manipulation functions and adjust README to indicate change in the way we make changes to pages. Repurpose those bytes into the pd_checksum field and explain how that works in comments about page header. Refactoring ahead of actual feature patch which would make use of the checksum field, arriving later. Jeff Davis, with comments and doc changes by Simon Riggs Direction suggested by Robert Haas; many others providing review comments.
This commit is contained in:
parent
4c855750fc
commit
bb7cc2623f
@ -4,7 +4,8 @@ MODULE_big = pageinspect
|
|||||||
OBJS = rawpage.o heapfuncs.o btreefuncs.o fsmfuncs.o
|
OBJS = rawpage.o heapfuncs.o btreefuncs.o fsmfuncs.o
|
||||||
|
|
||||||
EXTENSION = pageinspect
|
EXTENSION = pageinspect
|
||||||
DATA = pageinspect--1.0.sql pageinspect--unpackaged--1.0.sql
|
DATA = pageinspect--1.0.sql pageinspect--unpackaged--1.0.sql \
|
||||||
|
pageinspect--1.1.sql pageinspect--1.0--1.1.sql
|
||||||
|
|
||||||
ifdef USE_PGXS
|
ifdef USE_PGXS
|
||||||
PG_CONFIG = pg_config
|
PG_CONFIG = pg_config
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# pageinspect extension
|
# pageinspect extension
|
||||||
comment = 'inspect the contents of database pages at a low level'
|
comment = 'inspect the contents of database pages at a low level'
|
||||||
default_version = '1.0'
|
default_version = '1.1'
|
||||||
module_pathname = '$libdir/pageinspect'
|
module_pathname = '$libdir/pageinspect'
|
||||||
relocatable = true
|
relocatable = true
|
||||||
|
@ -211,7 +211,7 @@ page_header(PG_FUNCTION_ARGS)
|
|||||||
(uint32) (lsn >> 32), (uint32) lsn);
|
(uint32) (lsn >> 32), (uint32) lsn);
|
||||||
|
|
||||||
values[0] = CStringGetTextDatum(lsnchar);
|
values[0] = CStringGetTextDatum(lsnchar);
|
||||||
values[1] = UInt16GetDatum(PageGetTLI(page));
|
values[1] = UInt16GetDatum(page->pd_checksum);
|
||||||
values[2] = UInt16GetDatum(page->pd_flags);
|
values[2] = UInt16GetDatum(page->pd_flags);
|
||||||
values[3] = UInt16GetDatum(page->pd_lower);
|
values[3] = UInt16GetDatum(page->pd_lower);
|
||||||
values[4] = UInt16GetDatum(page->pd_upper);
|
values[4] = UInt16GetDatum(page->pd_upper);
|
||||||
|
@ -64,9 +64,9 @@
|
|||||||
passed as argument. For example:
|
passed as argument. For example:
|
||||||
<screen>
|
<screen>
|
||||||
test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));
|
test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));
|
||||||
lsn | tli | flags | lower | upper | special | pagesize | version | prune_xid
|
lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid
|
||||||
-----------+-----+-------+-------+-------+---------+----------+---------+-----------
|
-----------+----------+--------+-------+-------+---------+----------+---------+-----------
|
||||||
0/24A1B50 | 1 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
|
0/24A1B50 | 1 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
|
||||||
</screen>
|
</screen>
|
||||||
The returned columns correspond to the fields in the
|
The returned columns correspond to the fields in the
|
||||||
<structname>PageHeaderData</> struct.
|
<structname>PageHeaderData</> struct.
|
||||||
|
@ -308,7 +308,6 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack, GinStatsData *buildStats)
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_INSERT, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_INSERT, rdata);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LockBuffer(stack->buffer, GIN_UNLOCK);
|
LockBuffer(stack->buffer, GIN_UNLOCK);
|
||||||
@ -377,11 +376,8 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack, GinStatsData *buildStats)
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_SPLIT, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_SPLIT, rdata);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
PageSetLSN(lpage, recptr);
|
PageSetLSN(lpage, recptr);
|
||||||
PageSetTLI(lpage, ThisTimeLineID);
|
|
||||||
PageSetLSN(rpage, recptr);
|
PageSetLSN(rpage, recptr);
|
||||||
PageSetTLI(rpage, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockReleaseBuffer(rbuffer);
|
UnlockReleaseBuffer(rbuffer);
|
||||||
@ -426,9 +422,7 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack, GinStatsData *buildStats)
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_SPLIT, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_SPLIT, rdata);
|
||||||
PageSetLSN(lpage, recptr);
|
PageSetLSN(lpage, recptr);
|
||||||
PageSetTLI(lpage, ThisTimeLineID);
|
|
||||||
PageSetLSN(rpage, recptr);
|
PageSetLSN(rpage, recptr);
|
||||||
PageSetTLI(rpage, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(rbuffer);
|
UnlockReleaseBuffer(rbuffer);
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
|
@ -127,7 +127,6 @@ writeListPage(Relation index, Buffer buffer,
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_INSERT_LISTPAGE, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_INSERT_LISTPAGE, rdata);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get free space before releasing buffer */
|
/* get free space before releasing buffer */
|
||||||
@ -408,12 +407,10 @@ ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector)
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_UPDATE_META_PAGE, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_UPDATE_META_PAGE, rdata);
|
||||||
PageSetLSN(metapage, recptr);
|
PageSetLSN(metapage, recptr);
|
||||||
PageSetTLI(metapage, ThisTimeLineID);
|
|
||||||
|
|
||||||
if (buffer != InvalidBuffer)
|
if (buffer != InvalidBuffer)
|
||||||
{
|
{
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,13 +591,11 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead,
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_DELETE_LISTPAGE, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_DELETE_LISTPAGE, rdata);
|
||||||
PageSetLSN(metapage, recptr);
|
PageSetLSN(metapage, recptr);
|
||||||
PageSetTLI(metapage, ThisTimeLineID);
|
|
||||||
|
|
||||||
for (i = 0; i < data.ndeleted; i++)
|
for (i = 0; i < data.ndeleted; i++)
|
||||||
{
|
{
|
||||||
page = BufferGetPage(buffers[i]);
|
page = BufferGetPage(buffers[i]);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,6 @@ createPostingTree(Relation index, ItemPointerData *items, uint32 nitems)
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_CREATE_PTREE, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_CREATE_PTREE, rdata);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -431,11 +430,9 @@ ginbuild(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
page = BufferGetPage(RootBuffer);
|
page = BufferGetPage(RootBuffer);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
|
|
||||||
page = BufferGetPage(MetaBuffer);
|
page = BufferGetPage(MetaBuffer);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockReleaseBuffer(MetaBuffer);
|
UnlockReleaseBuffer(MetaBuffer);
|
||||||
|
@ -593,7 +593,6 @@ ginUpdateStats(Relation index, const GinStatsData *stats)
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_UPDATE_META_PAGE, &rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_UPDATE_META_PAGE, &rdata);
|
||||||
PageSetLSN(metapage, recptr);
|
PageSetLSN(metapage, recptr);
|
||||||
PageSetTLI(metapage, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockReleaseBuffer(metabuffer);
|
UnlockReleaseBuffer(metabuffer);
|
||||||
|
@ -147,7 +147,6 @@ xlogVacuumPage(Relation index, Buffer buffer)
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_VACUUM_PAGE, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_VACUUM_PAGE, rdata);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -350,14 +349,11 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_DELETE_PAGE, rdata);
|
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_DELETE_PAGE, rdata);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
PageSetLSN(parentPage, recptr);
|
PageSetLSN(parentPage, recptr);
|
||||||
PageSetTLI(parentPage, ThisTimeLineID);
|
|
||||||
if (leftBlkno != InvalidBlockNumber)
|
if (leftBlkno != InvalidBlockNumber)
|
||||||
{
|
{
|
||||||
page = BufferGetPage(lBuffer);
|
page = BufferGetPage(lBuffer);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,6 @@ ginRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
GinInitMetabuffer(MetaBuffer);
|
GinInitMetabuffer(MetaBuffer);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(MetaBuffer);
|
MarkBufferDirty(MetaBuffer);
|
||||||
|
|
||||||
RootBuffer = XLogReadBuffer(*node, GIN_ROOT_BLKNO, true);
|
RootBuffer = XLogReadBuffer(*node, GIN_ROOT_BLKNO, true);
|
||||||
@ -97,7 +96,6 @@ ginRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
GinInitBuffer(RootBuffer, GIN_LEAF);
|
GinInitBuffer(RootBuffer, GIN_LEAF);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(RootBuffer);
|
MarkBufferDirty(RootBuffer);
|
||||||
|
|
||||||
UnlockReleaseBuffer(RootBuffer);
|
UnlockReleaseBuffer(RootBuffer);
|
||||||
@ -124,7 +122,6 @@ ginRedoCreatePTree(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
GinPageGetOpaque(page)->maxoff = data->nitem;
|
GinPageGetOpaque(page)->maxoff = data->nitem;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -242,7 +239,6 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
@ -333,11 +329,9 @@ ginRedoSplit(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(rpage, lsn);
|
PageSetLSN(rpage, lsn);
|
||||||
PageSetTLI(rpage, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(rbuffer);
|
MarkBufferDirty(rbuffer);
|
||||||
|
|
||||||
PageSetLSN(lpage, lsn);
|
PageSetLSN(lpage, lsn);
|
||||||
PageSetTLI(lpage, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(lbuffer);
|
MarkBufferDirty(lbuffer);
|
||||||
|
|
||||||
if (!data->isLeaf && data->updateBlkno != InvalidBlockNumber)
|
if (!data->isLeaf && data->updateBlkno != InvalidBlockNumber)
|
||||||
@ -362,7 +356,6 @@ ginRedoSplit(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(rootPage, lsn);
|
PageSetLSN(rootPage, lsn);
|
||||||
PageSetTLI(rootPage, ThisTimeLineID);
|
|
||||||
|
|
||||||
MarkBufferDirty(rootBuf);
|
MarkBufferDirty(rootBuf);
|
||||||
UnlockReleaseBuffer(rootBuf);
|
UnlockReleaseBuffer(rootBuf);
|
||||||
@ -424,7 +417,6 @@ ginRedoVacuumPage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,7 +445,6 @@ ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
Assert(GinPageIsData(page));
|
Assert(GinPageIsData(page));
|
||||||
GinPageGetOpaque(page)->flags = GIN_DELETED;
|
GinPageGetOpaque(page)->flags = GIN_DELETED;
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(dbuffer);
|
MarkBufferDirty(dbuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -473,7 +464,6 @@ ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
Assert(!GinPageIsLeaf(page));
|
Assert(!GinPageIsLeaf(page));
|
||||||
GinPageDeletePostingItem(page, data->parentOffset);
|
GinPageDeletePostingItem(page, data->parentOffset);
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(pbuffer);
|
MarkBufferDirty(pbuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -492,7 +482,6 @@ ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
Assert(GinPageIsData(page));
|
Assert(GinPageIsData(page));
|
||||||
GinPageGetOpaque(page)->rightlink = data->rightLink;
|
GinPageGetOpaque(page)->rightlink = data->rightLink;
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(lbuffer);
|
MarkBufferDirty(lbuffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(lbuffer);
|
UnlockReleaseBuffer(lbuffer);
|
||||||
@ -522,7 +511,6 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
{
|
{
|
||||||
memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
|
memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
|
||||||
PageSetLSN(metapage, lsn);
|
PageSetLSN(metapage, lsn);
|
||||||
PageSetTLI(metapage, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(metabuffer);
|
MarkBufferDirty(metabuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +557,6 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
GinPageGetOpaque(page)->maxoff++;
|
GinPageGetOpaque(page)->maxoff++;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -595,7 +582,6 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
GinPageGetOpaque(page)->rightlink = data->newRightlink;
|
GinPageGetOpaque(page)->rightlink = data->newRightlink;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -655,7 +641,6 @@ ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
|
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -681,7 +666,6 @@ ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
{
|
{
|
||||||
memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
|
memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
|
||||||
PageSetLSN(metapage, lsn);
|
PageSetLSN(metapage, lsn);
|
||||||
PageSetTLI(metapage, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(metabuffer);
|
MarkBufferDirty(metabuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -708,7 +692,6 @@ ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
GinPageGetOpaque(page)->flags = GIN_DELETED;
|
GinPageGetOpaque(page)->flags = GIN_DELETED;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,6 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
|
|||||||
for (ptr = dist; ptr; ptr = ptr->next)
|
for (ptr = dist; ptr; ptr = ptr->next)
|
||||||
{
|
{
|
||||||
PageSetLSN(ptr->page, recptr);
|
PageSetLSN(ptr->page, recptr);
|
||||||
PageSetTLI(ptr->page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -458,7 +457,6 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
|
|||||||
leftchildbuf);
|
leftchildbuf);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -491,7 +489,6 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
|
|||||||
GistClearFollowRight(leftpg);
|
GistClearFollowRight(leftpg);
|
||||||
|
|
||||||
PageSetLSN(leftpg, recptr);
|
PageSetLSN(leftpg, recptr);
|
||||||
PageSetTLI(leftpg, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
|
@ -191,7 +191,6 @@ gistbuild(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
recptr = XLogInsert(RM_GIST_ID, XLOG_GIST_CREATE_INDEX, &rdata);
|
recptr = XLogInsert(RM_GIST_ID, XLOG_GIST_CREATE_INDEX, &rdata);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PageSetLSN(page, gistGetFakeLSN(heap));
|
PageSetLSN(page, gistGetFakeLSN(heap));
|
||||||
|
@ -235,7 +235,6 @@ gistbulkdelete(PG_FUNCTION_ARGS)
|
|||||||
todelete, ntodelete,
|
todelete, ntodelete,
|
||||||
NULL, 0, InvalidBuffer);
|
NULL, 0, InvalidBuffer);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PageSetLSN(page, gistGetFakeLSN(rel));
|
PageSetLSN(page, gistGetFakeLSN(rel));
|
||||||
|
@ -70,7 +70,6 @@ gistRedoClearFollowRight(XLogRecPtr lsn, XLogRecord *record, int block_index,
|
|||||||
GistClearFollowRight(page);
|
GistClearFollowRight(page);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -185,7 +184,6 @@ gistRedoPageUpdateRecord(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
|
|
||||||
GistPageGetOpaque(page)->rightlink = InvalidBlockNumber;
|
GistPageGetOpaque(page)->rightlink = InvalidBlockNumber;
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -289,7 +287,6 @@ gistRedoPageSplitRecord(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@ -324,7 +321,6 @@ gistRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
GISTInitBuffer(buffer, F_LEAF);
|
GISTInitBuffer(buffer, F_LEAF);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
|
@ -2129,7 +2129,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
|
|||||||
recptr = XLogInsert(RM_HEAP_ID, info, rdata);
|
recptr = XLogInsert(RM_HEAP_ID, info, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -2426,7 +2425,6 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
|
|||||||
recptr = XLogInsert(RM_HEAP2_ID, info, rdata);
|
recptr = XLogInsert(RM_HEAP2_ID, info, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -2787,7 +2785,6 @@ l1:
|
|||||||
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_DELETE, rdata);
|
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_DELETE, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -3570,10 +3567,8 @@ l2:
|
|||||||
if (newbuf != buffer)
|
if (newbuf != buffer)
|
||||||
{
|
{
|
||||||
PageSetLSN(BufferGetPage(newbuf), recptr);
|
PageSetLSN(BufferGetPage(newbuf), recptr);
|
||||||
PageSetTLI(BufferGetPage(newbuf), ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
PageSetLSN(BufferGetPage(buffer), recptr);
|
PageSetLSN(BufferGetPage(buffer), recptr);
|
||||||
PageSetTLI(BufferGetPage(buffer), ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -4472,7 +4467,6 @@ failed:
|
|||||||
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_LOCK, rdata);
|
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_LOCK, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -4889,7 +4883,6 @@ l4:
|
|||||||
recptr = XLogInsert(RM_HEAP2_ID, XLOG_HEAP2_LOCK_UPDATED, rdata);
|
recptr = XLogInsert(RM_HEAP2_ID, XLOG_HEAP2_LOCK_UPDATED, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -5033,7 +5026,6 @@ heap_inplace_update(Relation relation, HeapTuple tuple)
|
|||||||
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_INPLACE, rdata);
|
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_INPLACE, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -5915,7 +5907,6 @@ log_newpage(RelFileNode *rnode, ForkNumber forkNum, BlockNumber blkno,
|
|||||||
if (!PageIsNew(page))
|
if (!PageIsNew(page))
|
||||||
{
|
{
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -5964,7 +5955,6 @@ log_newpage_buffer(Buffer buffer)
|
|||||||
if (!PageIsNew(page))
|
if (!PageIsNew(page))
|
||||||
{
|
{
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return recptr;
|
return recptr;
|
||||||
@ -6066,7 +6056,6 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
|
|
||||||
@ -6134,7 +6123,6 @@ heap_xlog_freeze(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -6262,13 +6250,12 @@ heap_xlog_newpage(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
memcpy(page, (char *) xlrec + SizeOfHeapNewpage, BLCKSZ);
|
memcpy(page, (char *) xlrec + SizeOfHeapNewpage, BLCKSZ);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The page may be uninitialized. If so, we can't set the LSN and TLI
|
* The page may be uninitialized. If so, we can't set the LSN because that
|
||||||
* because that would corrupt the page.
|
* would corrupt the page.
|
||||||
*/
|
*/
|
||||||
if (!PageIsNew(page))
|
if (!PageIsNew(page))
|
||||||
{
|
{
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
@ -6374,7 +6361,6 @@ heap_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
/* Make sure there is no forward chain link in t_ctid */
|
/* Make sure there is no forward chain link in t_ctid */
|
||||||
htup->t_ctid = xlrec->target.tid;
|
htup->t_ctid = xlrec->target.tid;
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -6473,7 +6459,6 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
|
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
|
|
||||||
if (xlrec->all_visible_cleared)
|
if (xlrec->all_visible_cleared)
|
||||||
PageClearAllVisible(page);
|
PageClearAllVisible(page);
|
||||||
@ -6620,7 +6605,6 @@ heap_xlog_multi_insert(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
|
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
|
|
||||||
if (xlrec->all_visible_cleared)
|
if (xlrec->all_visible_cleared)
|
||||||
PageClearAllVisible(page);
|
PageClearAllVisible(page);
|
||||||
@ -6762,7 +6746,6 @@ heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool hot_update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(obuffer);
|
MarkBufferDirty(obuffer);
|
||||||
|
|
||||||
/* Deal with new tuple */
|
/* Deal with new tuple */
|
||||||
@ -6861,7 +6844,6 @@ newsame:;
|
|||||||
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
|
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(nbuffer);
|
MarkBufferDirty(nbuffer);
|
||||||
UnlockReleaseBuffer(nbuffer);
|
UnlockReleaseBuffer(nbuffer);
|
||||||
|
|
||||||
@ -6936,7 +6918,6 @@ heap_xlog_lock(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
/* Make sure there is no forward chain link in t_ctid */
|
/* Make sure there is no forward chain link in t_ctid */
|
||||||
htup->t_ctid = xlrec->target.tid;
|
htup->t_ctid = xlrec->target.tid;
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -6986,7 +6967,6 @@ heap_xlog_lock_updated(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
HeapTupleHeaderSetXmax(htup, xlrec->xmax);
|
HeapTupleHeaderSetXmax(htup, xlrec->xmax);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -7042,7 +7022,6 @@ heap_xlog_inplace(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
newlen);
|
newlen);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,6 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
|
|||||||
prstate.latestRemovedXid);
|
prstate.latestRemovedXid);
|
||||||
|
|
||||||
PageSetLSN(BufferGetPage(buffer), recptr);
|
PageSetLSN(BufferGetPage(buffer), recptr);
|
||||||
PageSetTLI(BufferGetPage(buffer), ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -274,7 +274,6 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, XLogRecPtr recptr,
|
|||||||
recptr = log_heap_visible(rel->rd_node, heapBlk, buf,
|
recptr = log_heap_visible(rel->rd_node, heapBlk, buf,
|
||||||
cutoff_xid);
|
cutoff_xid);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
|
@ -858,11 +858,9 @@ _bt_insertonpg(Relation rel,
|
|||||||
if (BufferIsValid(metabuf))
|
if (BufferIsValid(metabuf))
|
||||||
{
|
{
|
||||||
PageSetLSN(metapg, recptr);
|
PageSetLSN(metapg, recptr);
|
||||||
PageSetTLI(metapg, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -946,7 +944,6 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
|
|||||||
* examine these fields and possibly dump them in a page image.
|
* examine these fields and possibly dump them in a page image.
|
||||||
*/
|
*/
|
||||||
PageSetLSN(leftpage, PageGetLSN(origpage));
|
PageSetLSN(leftpage, PageGetLSN(origpage));
|
||||||
PageSetTLI(leftpage, PageGetTLI(origpage));
|
|
||||||
|
|
||||||
/* init btree private data */
|
/* init btree private data */
|
||||||
oopaque = (BTPageOpaque) PageGetSpecialPointer(origpage);
|
oopaque = (BTPageOpaque) PageGetSpecialPointer(origpage);
|
||||||
@ -1319,13 +1316,10 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
|
|||||||
recptr = XLogInsert(RM_BTREE_ID, xlinfo, rdata);
|
recptr = XLogInsert(RM_BTREE_ID, xlinfo, rdata);
|
||||||
|
|
||||||
PageSetLSN(origpage, recptr);
|
PageSetLSN(origpage, recptr);
|
||||||
PageSetTLI(origpage, ThisTimeLineID);
|
|
||||||
PageSetLSN(rightpage, recptr);
|
PageSetLSN(rightpage, recptr);
|
||||||
PageSetTLI(rightpage, ThisTimeLineID);
|
|
||||||
if (!P_RIGHTMOST(ropaque))
|
if (!P_RIGHTMOST(ropaque))
|
||||||
{
|
{
|
||||||
PageSetLSN(spage, recptr);
|
PageSetLSN(spage, recptr);
|
||||||
PageSetTLI(spage, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1961,9 +1955,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
|
|||||||
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_NEWROOT, rdata);
|
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_NEWROOT, rdata);
|
||||||
|
|
||||||
PageSetLSN(rootpage, recptr);
|
PageSetLSN(rootpage, recptr);
|
||||||
PageSetTLI(rootpage, ThisTimeLineID);
|
|
||||||
PageSetLSN(metapg, recptr);
|
PageSetLSN(metapg, recptr);
|
||||||
PageSetTLI(metapg, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
|
@ -241,9 +241,7 @@ _bt_getroot(Relation rel, int access)
|
|||||||
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_NEWROOT, &rdata);
|
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_NEWROOT, &rdata);
|
||||||
|
|
||||||
PageSetLSN(rootpage, recptr);
|
PageSetLSN(rootpage, recptr);
|
||||||
PageSetTLI(rootpage, ThisTimeLineID);
|
|
||||||
PageSetLSN(metapg, recptr);
|
PageSetLSN(metapg, recptr);
|
||||||
PageSetTLI(metapg, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -534,8 +532,8 @@ _bt_log_reuse_page(Relation rel, BlockNumber blkno, TransactionId latestRemovedX
|
|||||||
START_CRIT_SECTION();
|
START_CRIT_SECTION();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't do MarkBufferDirty here because we're about initialise the
|
* We don't do MarkBufferDirty here because we're about to initialise
|
||||||
* page, and nobody else can see it yet.
|
* the page, and nobody else can see it yet.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* XLOG stuff */
|
/* XLOG stuff */
|
||||||
@ -554,8 +552,8 @@ _bt_log_reuse_page(Relation rel, BlockNumber blkno, TransactionId latestRemovedX
|
|||||||
XLogInsert(RM_BTREE_ID, XLOG_BTREE_REUSE_PAGE, rdata);
|
XLogInsert(RM_BTREE_ID, XLOG_BTREE_REUSE_PAGE, rdata);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't do PageSetLSN or PageSetTLI here because we're about
|
* We don't do PageSetLSN here because we're about to initialise
|
||||||
* initialise the page, so no need.
|
* the page, so no need.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +861,6 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
|
|||||||
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_VACUUM, rdata);
|
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_VACUUM, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -951,7 +948,6 @@ _bt_delitems_delete(Relation rel, Buffer buf,
|
|||||||
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_DELETE, rdata);
|
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_DELETE, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -1533,22 +1529,17 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack)
|
|||||||
if (BufferIsValid(metabuf))
|
if (BufferIsValid(metabuf))
|
||||||
{
|
{
|
||||||
PageSetLSN(metapg, recptr);
|
PageSetLSN(metapg, recptr);
|
||||||
PageSetTLI(metapg, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
page = BufferGetPage(pbuf);
|
page = BufferGetPage(pbuf);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
page = BufferGetPage(rbuf);
|
page = BufferGetPage(rbuf);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
page = BufferGetPage(buf);
|
page = BufferGetPage(buf);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
if (BufferIsValid(lbuf))
|
if (BufferIsValid(lbuf))
|
||||||
{
|
{
|
||||||
page = BufferGetPage(lbuf);
|
page = BufferGetPage(lbuf);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,11 +276,6 @@ _bt_blwritepage(BTWriteState *wstate, Page page, BlockNumber blkno)
|
|||||||
/* We use the heap NEWPAGE record type for this */
|
/* We use the heap NEWPAGE record type for this */
|
||||||
log_newpage(&wstate->index->rd_node, MAIN_FORKNUM, blkno, page);
|
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
|
* If we have to write pages nonsequentially, fill in the space with
|
||||||
|
@ -186,7 +186,6 @@ _bt_restore_meta(RelFileNode rnode, XLogRecPtr lsn,
|
|||||||
((char *) md + sizeof(BTMetaPageData)) - (char *) metapg;
|
((char *) md + sizeof(BTMetaPageData)) - (char *) metapg;
|
||||||
|
|
||||||
PageSetLSN(metapg, lsn);
|
PageSetLSN(metapg, lsn);
|
||||||
PageSetTLI(metapg, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(metabuf);
|
MarkBufferDirty(metabuf);
|
||||||
UnlockReleaseBuffer(metabuf);
|
UnlockReleaseBuffer(metabuf);
|
||||||
}
|
}
|
||||||
@ -241,7 +240,6 @@ btree_xlog_insert(bool isleaf, bool ismeta,
|
|||||||
elog(PANIC, "btree_insert_redo: failed to add item");
|
elog(PANIC, "btree_insert_redo: failed to add item");
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -358,7 +356,6 @@ btree_xlog_split(bool onleft, bool isroot,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(rpage, lsn);
|
PageSetLSN(rpage, lsn);
|
||||||
PageSetTLI(rpage, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(rbuf);
|
MarkBufferDirty(rbuf);
|
||||||
|
|
||||||
/* don't release the buffer yet; we touch right page's first item below */
|
/* don't release the buffer yet; we touch right page's first item below */
|
||||||
@ -430,7 +427,6 @@ btree_xlog_split(bool onleft, bool isroot,
|
|||||||
lopaque->btpo_cycleid = 0;
|
lopaque->btpo_cycleid = 0;
|
||||||
|
|
||||||
PageSetLSN(lpage, lsn);
|
PageSetLSN(lpage, lsn);
|
||||||
PageSetTLI(lpage, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(lbuf);
|
MarkBufferDirty(lbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,7 +462,6 @@ btree_xlog_split(bool onleft, bool isroot,
|
|||||||
pageop->btpo_prev = xlrec->rightsib;
|
pageop->btpo_prev = xlrec->rightsib;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -563,7 +558,6 @@ btree_xlog_vacuum(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
|
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -780,7 +774,6 @@ btree_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
|
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -851,7 +844,6 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -877,7 +869,6 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
|
|||||||
pageop->btpo_prev = leftsib;
|
pageop->btpo_prev = leftsib;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -905,7 +896,6 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
|
|||||||
pageop->btpo_next = rightsib;
|
pageop->btpo_next = rightsib;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -928,7 +918,6 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
|
|||||||
pageop->btpo_cycleid = 0;
|
pageop->btpo_cycleid = 0;
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
|
|
||||||
@ -992,7 +981,6 @@ btree_xlog_newroot(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
|
|
||||||
|
@ -308,13 +308,11 @@ addLeafTuple(Relation index, SpGistState *state, SpGistLeafTuple leafTuple,
|
|||||||
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_ADD_LEAF, rdata);
|
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_ADD_LEAF, rdata);
|
||||||
|
|
||||||
PageSetLSN(current->page, recptr);
|
PageSetLSN(current->page, recptr);
|
||||||
PageSetTLI(current->page, ThisTimeLineID);
|
|
||||||
|
|
||||||
/* update parent only if we actually changed it */
|
/* update parent only if we actually changed it */
|
||||||
if (xlrec.blknoParent != InvalidBlockNumber)
|
if (xlrec.blknoParent != InvalidBlockNumber)
|
||||||
{
|
{
|
||||||
PageSetLSN(parent->page, recptr);
|
PageSetLSN(parent->page, recptr);
|
||||||
PageSetTLI(parent->page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,11 +546,8 @@ moveLeafs(Relation index, SpGistState *state,
|
|||||||
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_MOVE_LEAFS, rdata);
|
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_MOVE_LEAFS, rdata);
|
||||||
|
|
||||||
PageSetLSN(current->page, recptr);
|
PageSetLSN(current->page, recptr);
|
||||||
PageSetTLI(current->page, ThisTimeLineID);
|
|
||||||
PageSetLSN(npage, recptr);
|
PageSetLSN(npage, recptr);
|
||||||
PageSetTLI(npage, ThisTimeLineID);
|
|
||||||
PageSetLSN(parent->page, recptr);
|
PageSetLSN(parent->page, recptr);
|
||||||
PageSetTLI(parent->page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -1401,7 +1396,6 @@ doPickSplit(Relation index, SpGistState *state,
|
|||||||
Page page = BufferGetPage(newLeafBuffer);
|
Page page = BufferGetPage(newLeafBuffer);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveCurrent.buffer != InvalidBuffer)
|
if (saveCurrent.buffer != InvalidBuffer)
|
||||||
@ -1409,16 +1403,13 @@ doPickSplit(Relation index, SpGistState *state,
|
|||||||
Page page = BufferGetPage(saveCurrent.buffer);
|
Page page = BufferGetPage(saveCurrent.buffer);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(current->page, recptr);
|
PageSetLSN(current->page, recptr);
|
||||||
PageSetTLI(current->page, ThisTimeLineID);
|
|
||||||
|
|
||||||
if (parent->buffer != InvalidBuffer)
|
if (parent->buffer != InvalidBuffer)
|
||||||
{
|
{
|
||||||
PageSetLSN(parent->page, recptr);
|
PageSetLSN(parent->page, recptr);
|
||||||
PageSetTLI(parent->page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1557,7 +1548,6 @@ spgAddNodeAction(Relation index, SpGistState *state,
|
|||||||
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_ADD_NODE, rdata);
|
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_ADD_NODE, rdata);
|
||||||
|
|
||||||
PageSetLSN(current->page, recptr);
|
PageSetLSN(current->page, recptr);
|
||||||
PageSetTLI(current->page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -1667,11 +1657,8 @@ spgAddNodeAction(Relation index, SpGistState *state,
|
|||||||
|
|
||||||
/* we don't bother to check if any of these are redundant */
|
/* we don't bother to check if any of these are redundant */
|
||||||
PageSetLSN(current->page, recptr);
|
PageSetLSN(current->page, recptr);
|
||||||
PageSetTLI(current->page, ThisTimeLineID);
|
|
||||||
PageSetLSN(parent->page, recptr);
|
PageSetLSN(parent->page, recptr);
|
||||||
PageSetTLI(parent->page, ThisTimeLineID);
|
|
||||||
PageSetLSN(saveCurrent.page, recptr);
|
PageSetLSN(saveCurrent.page, recptr);
|
||||||
PageSetTLI(saveCurrent.page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -1831,12 +1818,10 @@ spgSplitNodeAction(Relation index, SpGistState *state,
|
|||||||
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_SPLIT_TUPLE, rdata);
|
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_SPLIT_TUPLE, rdata);
|
||||||
|
|
||||||
PageSetLSN(current->page, recptr);
|
PageSetLSN(current->page, recptr);
|
||||||
PageSetTLI(current->page, ThisTimeLineID);
|
|
||||||
|
|
||||||
if (newBuffer != InvalidBuffer)
|
if (newBuffer != InvalidBuffer)
|
||||||
{
|
{
|
||||||
PageSetLSN(BufferGetPage(newBuffer), recptr);
|
PageSetLSN(BufferGetPage(newBuffer), recptr);
|
||||||
PageSetTLI(BufferGetPage(newBuffer), ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,11 +105,8 @@ spgbuild(PG_FUNCTION_ARGS)
|
|||||||
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_CREATE_INDEX, &rdata);
|
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_CREATE_INDEX, &rdata);
|
||||||
|
|
||||||
PageSetLSN(BufferGetPage(metabuffer), recptr);
|
PageSetLSN(BufferGetPage(metabuffer), recptr);
|
||||||
PageSetTLI(BufferGetPage(metabuffer), ThisTimeLineID);
|
|
||||||
PageSetLSN(BufferGetPage(rootbuffer), recptr);
|
PageSetLSN(BufferGetPage(rootbuffer), recptr);
|
||||||
PageSetTLI(BufferGetPage(rootbuffer), ThisTimeLineID);
|
|
||||||
PageSetLSN(BufferGetPage(nullbuffer), recptr);
|
PageSetLSN(BufferGetPage(nullbuffer), recptr);
|
||||||
PageSetTLI(BufferGetPage(nullbuffer), ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
|
@ -392,7 +392,6 @@ vacuumLeafPage(spgBulkDeleteState *bds, Relation index, Buffer buffer,
|
|||||||
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_LEAF, rdata);
|
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_LEAF, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -473,7 +472,6 @@ vacuumLeafRoot(spgBulkDeleteState *bds, Relation index, Buffer buffer)
|
|||||||
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_ROOT, rdata);
|
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_ROOT, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -594,7 +592,6 @@ vacuumRedirectAndPlaceholder(Relation index, Buffer buffer)
|
|||||||
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_REDIRECT, rdata);
|
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_REDIRECT, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
|
@ -84,7 +84,6 @@ spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
page = (Page) BufferGetPage(buffer);
|
page = (Page) BufferGetPage(buffer);
|
||||||
SpGistInitMetapage(page);
|
SpGistInitMetapage(page);
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
|
|
||||||
@ -93,7 +92,6 @@ spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
SpGistInitBuffer(buffer, SPGIST_LEAF);
|
SpGistInitBuffer(buffer, SPGIST_LEAF);
|
||||||
page = (Page) BufferGetPage(buffer);
|
page = (Page) BufferGetPage(buffer);
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
|
|
||||||
@ -102,7 +100,6 @@ spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
SpGistInitBuffer(buffer, SPGIST_LEAF | SPGIST_NULLS);
|
SpGistInitBuffer(buffer, SPGIST_LEAF | SPGIST_NULLS);
|
||||||
page = (Page) BufferGetPage(buffer);
|
page = (Page) BufferGetPage(buffer);
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
}
|
}
|
||||||
@ -171,7 +168,6 @@ spgRedoAddLeaf(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -198,7 +194,6 @@ spgRedoAddLeaf(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
xldata->blknoLeaf, xldata->offnumLeaf);
|
xldata->blknoLeaf, xldata->offnumLeaf);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -264,7 +259,6 @@ spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -289,7 +283,6 @@ spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
toInsert[nInsert - 1]);
|
toInsert[nInsert - 1]);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -316,7 +309,6 @@ spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
xldata->blknoDst, toInsert[nInsert - 1]);
|
xldata->blknoDst, toInsert[nInsert - 1]);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -363,7 +355,6 @@ spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
innerTuple->size);
|
innerTuple->size);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -413,7 +404,6 @@ spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
if (xldata->blknoParent != xldata->blknoNew)
|
if (xldata->blknoParent != xldata->blknoNew)
|
||||||
{
|
{
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
@ -464,7 +454,6 @@ spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
if (xldata->blknoParent != xldata->blkno)
|
if (xldata->blknoParent != xldata->blkno)
|
||||||
{
|
{
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
@ -506,7 +495,6 @@ spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
xldata->blknoNew, xldata->offnumNew);
|
xldata->blknoNew, xldata->offnumNew);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -558,7 +546,6 @@ spgRedoSplitTuple(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
postfixTuple->size, xldata->offnumPostfix);
|
postfixTuple->size, xldata->offnumPostfix);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -588,7 +575,6 @@ spgRedoSplitTuple(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
xldata->offnumPostfix);
|
xldata->offnumPostfix);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -764,13 +750,11 @@ spgRedoPickSplit(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
if (srcPage != NULL)
|
if (srcPage != NULL)
|
||||||
{
|
{
|
||||||
PageSetLSN(srcPage, lsn);
|
PageSetLSN(srcPage, lsn);
|
||||||
PageSetTLI(srcPage, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(srcBuffer);
|
MarkBufferDirty(srcBuffer);
|
||||||
}
|
}
|
||||||
if (destPage != NULL)
|
if (destPage != NULL)
|
||||||
{
|
{
|
||||||
PageSetLSN(destPage, lsn);
|
PageSetLSN(destPage, lsn);
|
||||||
PageSetTLI(destPage, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(destBuffer);
|
MarkBufferDirty(destBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -807,7 +791,6 @@ spgRedoPickSplit(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -852,7 +835,6 @@ spgRedoPickSplit(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
xldata->blknoInner, xldata->offnumInner);
|
xldata->blknoInner, xldata->offnumInner);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -943,7 +925,6 @@ spgRedoVacuumLeaf(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -977,7 +958,6 @@ spgRedoVacuumRoot(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
PageIndexMultiDelete(page, toDelete, xldata->nDelete);
|
PageIndexMultiDelete(page, toDelete, xldata->nDelete);
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
@ -1060,7 +1040,6 @@ spgRedoVacuumRedirect(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,13 +439,14 @@ critical section.)
|
|||||||
happen before the WAL record is inserted; see notes in SyncOneBuffer().)
|
happen before the WAL record is inserted; see notes in SyncOneBuffer().)
|
||||||
|
|
||||||
5. If the relation requires WAL-logging, build a WAL log record and pass it
|
5. If the relation requires WAL-logging, build a WAL log record and pass it
|
||||||
to XLogInsert(); then update the page's LSN and TLI using the returned XLOG
|
to XLogInsert(); then update the page's LSN using the returned XLOG
|
||||||
location. For instance,
|
location. For instance,
|
||||||
|
|
||||||
recptr = XLogInsert(rmgr_id, info, rdata);
|
recptr = XLogInsert(rmgr_id, info, rdata);
|
||||||
|
|
||||||
PageSetLSN(dp, recptr);
|
PageSetLSN(dp, recptr);
|
||||||
PageSetTLI(dp, ThisTimeLineID);
|
// Note that we no longer do PageSetTLI() from 9.3 onwards
|
||||||
|
// since that field on a page has now changed its meaning.
|
||||||
|
|
||||||
6. END_CRIT_SECTION()
|
6. END_CRIT_SECTION()
|
||||||
|
|
||||||
@ -489,7 +490,6 @@ standard replay-routine pattern for this case is
|
|||||||
... initialize the page ...
|
... initialize the page ...
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
|
|
||||||
@ -523,7 +523,6 @@ The standard replay-routine pattern for this case is
|
|||||||
... apply the change ...
|
... apply the change ...
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
UnlockReleaseBuffer(buffer);
|
UnlockReleaseBuffer(buffer);
|
||||||
|
|
||||||
|
@ -3188,7 +3188,6 @@ RestoreBackupBlock(XLogRecPtr lsn, XLogRecord *record, int block_index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
|
|
||||||
if (!keep_buffer)
|
if (!keep_buffer)
|
||||||
|
@ -393,7 +393,6 @@ fill_seq_with_data(Relation rel, HeapTuple tuple)
|
|||||||
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
|
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -477,7 +476,6 @@ AlterSequence(AlterSeqStmt *stmt)
|
|||||||
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
|
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -741,7 +739,6 @@ nextval_internal(Oid relid)
|
|||||||
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
|
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now update sequence tuple to the intended final state */
|
/* Now update sequence tuple to the intended final state */
|
||||||
@ -919,7 +916,6 @@ do_setval(Oid relid, int64 next, bool iscalled)
|
|||||||
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
|
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
|
||||||
|
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
@ -1598,7 +1594,6 @@ seq_redo(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
elog(PANIC, "seq_redo: failed to add item to page");
|
elog(PANIC, "seq_redo: failed to add item to page");
|
||||||
|
|
||||||
PageSetLSN(localpage, lsn);
|
PageSetLSN(localpage, lsn);
|
||||||
PageSetTLI(localpage, ThisTimeLineID);
|
|
||||||
|
|
||||||
memcpy(page, localpage, BufferGetPageSize(buffer));
|
memcpy(page, localpage, BufferGetPageSize(buffer));
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
|
@ -876,7 +876,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
|
|||||||
recptr = log_heap_freeze(onerel, buf, FreezeLimit,
|
recptr = log_heap_freeze(onerel, buf, FreezeLimit,
|
||||||
MultiXactFrzLimit, frozen, nfrozen);
|
MultiXactFrzLimit, frozen, nfrozen);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1171,7 +1170,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
|
|||||||
unused, uncnt,
|
unused, uncnt,
|
||||||
vacrelstats->latestRemovedXid);
|
vacrelstats->latestRemovedXid);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
PageSetTLI(page, ThisTimeLineID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_CRIT_SECTION();
|
END_CRIT_SECTION();
|
||||||
|
@ -103,7 +103,7 @@ typedef struct
|
|||||||
* space management information generic to any page
|
* space management information generic to any page
|
||||||
*
|
*
|
||||||
* pd_lsn - identifies xlog record for last change to this page.
|
* pd_lsn - identifies xlog record for last change to this page.
|
||||||
* pd_tli - ditto.
|
* pd_checksum - page checksum, if set.
|
||||||
* pd_flags - flag bits.
|
* pd_flags - flag bits.
|
||||||
* pd_lower - offset to start of free space.
|
* pd_lower - offset to start of free space.
|
||||||
* pd_upper - offset to end of free space.
|
* pd_upper - offset to end of free space.
|
||||||
@ -114,9 +114,17 @@ typedef struct
|
|||||||
* The LSN is used by the buffer manager to enforce the basic rule of WAL:
|
* The LSN is used by the buffer manager to enforce the basic rule of WAL:
|
||||||
* "thou shalt write xlog before data". A dirty buffer cannot be dumped
|
* "thou shalt write xlog before data". A dirty buffer cannot be dumped
|
||||||
* to disk until xlog has been flushed at least as far as the page's LSN.
|
* to disk until xlog has been flushed at least as far as the page's LSN.
|
||||||
* We also store the 16 least significant bits of the TLI for identification
|
*
|
||||||
* purposes (it is not clear that this is actually necessary, but it seems
|
* pd_checksum stores the page checksum, if it has been set for this page;
|
||||||
* like a good idea).
|
* zero is a valid value for a checksum. If a checksum is not in use then
|
||||||
|
* we leave the field unset. This will typically mean the field is zero
|
||||||
|
* though non-zero values may also be present if databases have been
|
||||||
|
* pg_upgraded from releases prior to 9.3, when the same byte offset was
|
||||||
|
* used to store the current timelineid when the page was last updated.
|
||||||
|
* Note that there is no indication on a page as to whether the checksum
|
||||||
|
* is valid or not, a deliberate design choice which avoids the problem
|
||||||
|
* of relying on the page contents to decide whether to verify it. Hence
|
||||||
|
* there are no flag bits relating to checksums.
|
||||||
*
|
*
|
||||||
* pd_prune_xid is a hint field that helps determine whether pruning will be
|
* pd_prune_xid is a hint field that helps determine whether pruning will be
|
||||||
* useful. It is currently unused in index pages.
|
* useful. It is currently unused in index pages.
|
||||||
@ -138,10 +146,9 @@ typedef struct
|
|||||||
typedef struct PageHeaderData
|
typedef struct PageHeaderData
|
||||||
{
|
{
|
||||||
/* XXX LSN is member of *any* block, not only page-organized ones */
|
/* XXX LSN is member of *any* block, not only page-organized ones */
|
||||||
PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog
|
PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog
|
||||||
* record for last change to this page */
|
* record for last change to this page */
|
||||||
uint16 pd_tli; /* least significant bits of the TimeLineID
|
uint16 pd_checksum; /* checksum */
|
||||||
* containing the LSN */
|
|
||||||
uint16 pd_flags; /* flag bits, see below */
|
uint16 pd_flags; /* flag bits, see below */
|
||||||
LocationIndex pd_lower; /* offset to start of free space */
|
LocationIndex pd_lower; /* offset to start of free space */
|
||||||
LocationIndex pd_upper; /* offset to end of free space */
|
LocationIndex pd_upper; /* offset to end of free space */
|
||||||
@ -335,12 +342,6 @@ typedef PageHeaderData *PageHeader;
|
|||||||
#define PageSetLSN(page, lsn) \
|
#define PageSetLSN(page, lsn) \
|
||||||
PageXLogRecPtrSet(((PageHeader) (page))->pd_lsn, lsn)
|
PageXLogRecPtrSet(((PageHeader) (page))->pd_lsn, lsn)
|
||||||
|
|
||||||
/* NOTE: only the 16 least significant bits are stored */
|
|
||||||
#define PageGetTLI(page) \
|
|
||||||
(((PageHeader) (page))->pd_tli)
|
|
||||||
#define PageSetTLI(page, tli) \
|
|
||||||
(((PageHeader) (page))->pd_tli = (uint16) (tli))
|
|
||||||
|
|
||||||
#define PageHasFreeLinePointers(page) \
|
#define PageHasFreeLinePointers(page) \
|
||||||
(((PageHeader) (page))->pd_flags & PD_HAS_FREE_LINES)
|
(((PageHeader) (page))->pd_flags & PD_HAS_FREE_LINES)
|
||||||
#define PageSetHasFreeLinePointers(page) \
|
#define PageSetHasFreeLinePointers(page) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user