Commit bb7cc262 authored by Simon Riggs's avatar Simon Riggs

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.
parent 4c855750
......@@ -4,7 +4,8 @@ MODULE_big = pageinspect
OBJS = rawpage.o heapfuncs.o btreefuncs.o fsmfuncs.o
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
PG_CONFIG = pg_config
......
# pageinspect extension
comment = 'inspect the contents of database pages at a low level'
default_version = '1.0'
default_version = '1.1'
module_pathname = '$libdir/pageinspect'
relocatable = true
......@@ -211,7 +211,7 @@ page_header(PG_FUNCTION_ARGS)
(uint32) (lsn >> 32), (uint32) lsn);
values[0] = CStringGetTextDatum(lsnchar);
values[1] = UInt16GetDatum(PageGetTLI(page));
values[1] = UInt16GetDatum(page->pd_checksum);
values[2] = UInt16GetDatum(page->pd_flags);
values[3] = UInt16GetDatum(page->pd_lower);
values[4] = UInt16GetDatum(page->pd_upper);
......
......@@ -64,9 +64,9 @@
passed as argument. For example:
<screen>
test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));
lsn | tli | flags | lower | upper | special | pagesize | version | prune_xid
-----------+-----+-------+-------+-------+---------+----------+---------+-----------
0/24A1B50 | 1 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid
-----------+----------+--------+-------+-------+---------+----------+---------+-----------
0/24A1B50 | 1 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
</screen>
The returned columns correspond to the fields in the
<structname>PageHeaderData</> struct.
......
......@@ -308,7 +308,6 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack, GinStatsData *buildStats)
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_INSERT, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
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);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
PageSetLSN(lpage, recptr);
PageSetTLI(lpage, ThisTimeLineID);
PageSetLSN(rpage, recptr);
PageSetTLI(rpage, ThisTimeLineID);
}
UnlockReleaseBuffer(rbuffer);
......@@ -426,9 +422,7 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack, GinStatsData *buildStats)
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_SPLIT, rdata);
PageSetLSN(lpage, recptr);
PageSetTLI(lpage, ThisTimeLineID);
PageSetLSN(rpage, recptr);
PageSetTLI(rpage, ThisTimeLineID);
}
UnlockReleaseBuffer(rbuffer);
END_CRIT_SECTION();
......
......@@ -127,7 +127,6 @@ writeListPage(Relation index, Buffer buffer,
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_INSERT_LISTPAGE, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
/* 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);
PageSetLSN(metapage, recptr);
PageSetTLI(metapage, ThisTimeLineID);
if (buffer != InvalidBuffer)
{
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);
PageSetLSN(metapage, recptr);
PageSetTLI(metapage, ThisTimeLineID);
for (i = 0; i < data.ndeleted; i++)
{
page = BufferGetPage(buffers[i]);
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);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
UnlockReleaseBuffer(buffer);
......@@ -431,11 +430,9 @@ ginbuild(PG_FUNCTION_ARGS)
page = BufferGetPage(RootBuffer);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
page = BufferGetPage(MetaBuffer);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
UnlockReleaseBuffer(MetaBuffer);
......
......@@ -593,7 +593,6 @@ ginUpdateStats(Relation index, const GinStatsData *stats)
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_UPDATE_META_PAGE, &rdata);
PageSetLSN(metapage, recptr);
PageSetTLI(metapage, ThisTimeLineID);
}
UnlockReleaseBuffer(metabuffer);
......
......@@ -147,7 +147,6 @@ xlogVacuumPage(Relation index, Buffer buffer)
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_VACUUM_PAGE, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
static bool
......@@ -350,14 +349,11 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_DELETE_PAGE, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
PageSetLSN(parentPage, recptr);
PageSetTLI(parentPage, ThisTimeLineID);
if (leftBlkno != InvalidBlockNumber)
{
page = BufferGetPage(lBuffer);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
}
......
......@@ -87,7 +87,6 @@ ginRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
GinInitMetabuffer(MetaBuffer);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(MetaBuffer);
RootBuffer = XLogReadBuffer(*node, GIN_ROOT_BLKNO, true);
......@@ -97,7 +96,6 @@ ginRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
GinInitBuffer(RootBuffer, GIN_LEAF);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(RootBuffer);
UnlockReleaseBuffer(RootBuffer);
......@@ -124,7 +122,6 @@ ginRedoCreatePTree(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->maxoff = data->nitem;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......@@ -242,7 +239,6 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
......@@ -333,11 +329,9 @@ ginRedoSplit(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(rpage, lsn);
PageSetTLI(rpage, ThisTimeLineID);
MarkBufferDirty(rbuffer);
PageSetLSN(lpage, lsn);
PageSetTLI(lpage, ThisTimeLineID);
MarkBufferDirty(lbuffer);
if (!data->isLeaf && data->updateBlkno != InvalidBlockNumber)
......@@ -362,7 +356,6 @@ ginRedoSplit(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(rootPage, lsn);
PageSetTLI(rootPage, ThisTimeLineID);
MarkBufferDirty(rootBuf);
UnlockReleaseBuffer(rootBuf);
......@@ -424,7 +417,6 @@ ginRedoVacuumPage(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
......@@ -453,7 +445,6 @@ ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
Assert(GinPageIsData(page));
GinPageGetOpaque(page)->flags = GIN_DELETED;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(dbuffer);
}
}
......@@ -473,7 +464,6 @@ ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
Assert(!GinPageIsLeaf(page));
GinPageDeletePostingItem(page, data->parentOffset);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(pbuffer);
}
}
......@@ -492,7 +482,6 @@ ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
Assert(GinPageIsData(page));
GinPageGetOpaque(page)->rightlink = data->rightLink;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(lbuffer);
}
UnlockReleaseBuffer(lbuffer);
......@@ -522,7 +511,6 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
{
memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
PageSetLSN(metapage, lsn);
PageSetTLI(metapage, ThisTimeLineID);
MarkBufferDirty(metabuffer);
}
......@@ -569,7 +557,6 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->maxoff++;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -595,7 +582,6 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->rightlink = data->newRightlink;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -655,7 +641,6 @@ ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......@@ -681,7 +666,6 @@ ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
{
memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
PageSetLSN(metapage, lsn);
PageSetTLI(metapage, ThisTimeLineID);
MarkBufferDirty(metabuffer);
}
......@@ -708,7 +692,6 @@ ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->flags = GIN_DELETED;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
......
......@@ -410,7 +410,6 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
for (ptr = dist; ptr; ptr = ptr->next)
{
PageSetLSN(ptr->page, recptr);
PageSetTLI(ptr->page, ThisTimeLineID);
}
/*
......@@ -458,7 +457,6 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
leftchildbuf);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
else
{
......@@ -491,7 +489,6 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
GistClearFollowRight(leftpg);
PageSetLSN(leftpg, recptr);
PageSetTLI(leftpg, ThisTimeLineID);
}
END_CRIT_SECTION();
......
......@@ -191,7 +191,6 @@ gistbuild(PG_FUNCTION_ARGS)
recptr = XLogInsert(RM_GIST_ID, XLOG_GIST_CREATE_INDEX, &rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
else
PageSetLSN(page, gistGetFakeLSN(heap));
......
......@@ -235,7 +235,6 @@ gistbulkdelete(PG_FUNCTION_ARGS)
todelete, ntodelete,
NULL, 0, InvalidBuffer);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
else
PageSetLSN(page, gistGetFakeLSN(rel));
......
......@@ -70,7 +70,6 @@ gistRedoClearFollowRight(XLogRecPtr lsn, XLogRecord *record, int block_index,
GistClearFollowRight(page);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -185,7 +184,6 @@ gistRedoPageUpdateRecord(XLogRecPtr lsn, XLogRecord *record)
GistPageGetOpaque(page)->rightlink = InvalidBlockNumber;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -289,7 +287,6 @@ gistRedoPageSplitRecord(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
if (i == 0)
......@@ -324,7 +321,6 @@ gistRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
GISTInitBuffer(buffer, F_LEAF);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......
......@@ -2129,7 +2129,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
recptr = XLogInsert(RM_HEAP_ID, info, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -2426,7 +2425,6 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
recptr = XLogInsert(RM_HEAP2_ID, info, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -2787,7 +2785,6 @@ l1:
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_DELETE, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -3570,10 +3567,8 @@ l2:
if (newbuf != buffer)
{
PageSetLSN(BufferGetPage(newbuf), recptr);
PageSetTLI(BufferGetPage(newbuf), ThisTimeLineID);
}
PageSetLSN(BufferGetPage(buffer), recptr);
PageSetTLI(BufferGetPage(buffer), ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -4472,7 +4467,6 @@ failed:
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_LOCK, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -4889,7 +4883,6 @@ l4:
recptr = XLogInsert(RM_HEAP2_ID, XLOG_HEAP2_LOCK_UPDATED, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -5033,7 +5026,6 @@ heap_inplace_update(Relation relation, HeapTuple tuple)
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_INPLACE, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -5915,7 +5907,6 @@ log_newpage(RelFileNode *rnode, ForkNumber forkNum, BlockNumber blkno,
if (!PageIsNew(page))
{
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -5964,7 +5955,6 @@ log_newpage_buffer(Buffer buffer)
if (!PageIsNew(page))
{
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
return recptr;
......@@ -6066,7 +6056,6 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record)
*/
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......@@ -6134,7 +6123,6 @@ heap_xlog_freeze(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -6262,13 +6250,12 @@ heap_xlog_newpage(XLogRecPtr lsn, XLogRecord *record)
memcpy(page, (char *) xlrec + SizeOfHeapNewpage, BLCKSZ);
/*
* The page may be uninitialized. If so, we can't set the LSN and TLI
* because that would corrupt the page.
* The page may be uninitialized. If so, we can't set the LSN because that
* would corrupt the page.
*/
if (!PageIsNew(page))
{
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
}
MarkBufferDirty(buffer);
......@@ -6374,7 +6361,6 @@ heap_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
/* Make sure there is no forward chain link in t_ctid */
htup->t_ctid = xlrec->target.tid;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -6473,7 +6459,6 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
if (xlrec->all_visible_cleared)
PageClearAllVisible(page);
......@@ -6620,7 +6605,6 @@ heap_xlog_multi_insert(XLogRecPtr lsn, XLogRecord *record)
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
if (xlrec->all_visible_cleared)
PageClearAllVisible(page);
......@@ -6762,7 +6746,6 @@ heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool hot_update)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(obuffer);
/* Deal with new tuple */
......@@ -6861,7 +6844,6 @@ newsame:;
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(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 */
htup->t_ctid = xlrec->target.tid;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -6986,7 +6967,6 @@ heap_xlog_lock_updated(XLogRecPtr lsn, XLogRecord *record)
HeapTupleHeaderSetXmax(htup, xlrec->xmax);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -7042,7 +7022,6 @@ heap_xlog_inplace(XLogRecPtr lsn, XLogRecord *record)
newlen);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......
......@@ -244,7 +244,6 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
prstate.latestRemovedXid);
PageSetLSN(BufferGetPage(buffer), recptr);
PageSetTLI(BufferGetPage(buffer), ThisTimeLineID);
}
}
else
......
......@@ -274,7 +274,6 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, XLogRecPtr recptr,
recptr = log_heap_visible(rel->rd_node, heapBlk, buf,
cutoff_xid);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......
......@@ -858,11 +858,9 @@ _bt_insertonpg(Relation rel,
if (BufferIsValid(metabuf))
{
PageSetLSN(metapg, recptr);
PageSetTLI(metapg, ThisTimeLineID);
}
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
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.
*/
PageSetLSN(leftpage, PageGetLSN(origpage));
PageSetTLI(leftpage, PageGetTLI(origpage));
/* init btree private data */
oopaque = (BTPageOpaque) PageGetSpecialPointer(origpage);
......@@ -1319,13 +1316,10 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
recptr = XLogInsert(RM_BTREE_ID, xlinfo, rdata);
PageSetLSN(origpage, recptr);
PageSetTLI(origpage, ThisTimeLineID);
PageSetLSN(rightpage, recptr);
PageSetTLI(rightpage, ThisTimeLineID);
if (!P_RIGHTMOST(ropaque))
{
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);
PageSetLSN(rootpage, recptr);
PageSetTLI(rootpage, ThisTimeLineID);
PageSetLSN(metapg, recptr);
PageSetTLI(metapg, ThisTimeLineID);
}
END_CRIT_SECTION();
......
......@@ -241,9 +241,7 @@ _bt_getroot(Relation rel, int access)
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_NEWROOT, &rdata);
PageSetLSN(rootpage, recptr);
PageSetTLI(rootpage, ThisTimeLineID);
PageSetLSN(metapg, recptr);
PageSetTLI(metapg, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -534,8 +532,8 @@ _bt_log_reuse_page(Relation rel, BlockNumber blkno, TransactionId latestRemovedX
START_CRIT_SECTION();
/*
* We don't do MarkBufferDirty here because we're about initialise the
* page, and nobody else can see it yet.
* We don't do MarkBufferDirty here because we're about to initialise
* the page, and nobody else can see it yet.
*/
/* 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);
/*
* We don't do PageSetLSN or PageSetTLI here because we're about
* initialise the page, so no need.
* We don't do PageSetLSN here because we're about to initialise
* 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);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -951,7 +948,6 @@ _bt_delitems_delete(Relation rel, Buffer buf,
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_DELETE, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -1533,22 +1529,17 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack)
if (BufferIsValid(metabuf))
{
PageSetLSN(metapg, recptr);
PageSetTLI(metapg, ThisTimeLineID);
}
page = BufferGetPage(pbuf);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
page = BufferGetPage(rbuf);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
page = BufferGetPage(buf);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
if (BufferIsValid(lbuf))
{
page = BufferGetPage(lbuf);
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 */
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
......
......@@ -186,7 +186,6 @@ _bt_restore_meta(RelFileNode rnode, XLogRecPtr lsn,
((char *) md + sizeof(BTMetaPageData)) - (char *) metapg;
PageSetLSN(metapg, lsn);
PageSetTLI(metapg, ThisTimeLineID);
MarkBufferDirty(metabuf);
UnlockReleaseBuffer(metabuf);
}
......@@ -241,7 +240,6 @@ btree_xlog_insert(bool isleaf, bool ismeta,
elog(PANIC, "btree_insert_redo: failed to add item");
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -358,7 +356,6 @@ btree_xlog_split(bool onleft, bool isroot,
}
PageSetLSN(rpage, lsn);
PageSetTLI(rpage, ThisTimeLineID);
MarkBufferDirty(rbuf);
/* 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;
PageSetLSN(lpage, lsn);
PageSetTLI(lpage, ThisTimeLineID);
MarkBufferDirty(lbuf);
}
......@@ -466,7 +462,6 @@ btree_xlog_split(bool onleft, bool isroot,
pageop->btpo_prev = xlrec->rightsib;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -563,7 +558,6 @@ btree_xlog_vacuum(XLogRecPtr lsn, XLogRecord *record)
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -780,7 +774,6 @@ btree_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -851,7 +844,6 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -877,7 +869,6 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
pageop->btpo_prev = leftsib;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -905,7 +896,6 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
pageop->btpo_next = rightsib;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -928,7 +918,6 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
pageop->btpo_cycleid = 0;
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......@@ -992,7 +981,6 @@ btree_xlog_newroot(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......
......@@ -308,13 +308,11 @@ addLeafTuple(Relation index, SpGistState *state, SpGistLeafTuple leafTuple,
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_ADD_LEAF, rdata);
PageSetLSN(current->page, recptr);
PageSetTLI(current->page, ThisTimeLineID);
/* update parent only if we actually changed it */
if (xlrec.blknoParent != InvalidBlockNumber)
{
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);
PageSetLSN(current->page, recptr);
PageSetTLI(current->page, ThisTimeLineID);
PageSetLSN(npage, recptr);
PageSetTLI(npage, ThisTimeLineID);
PageSetLSN(parent->page, recptr);
PageSetTLI(parent->page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -1401,7 +1396,6 @@ doPickSplit(Relation index, SpGistState *state,
Page page = BufferGetPage(newLeafBuffer);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
if (saveCurrent.buffer != InvalidBuffer)
......@@ -1409,16 +1403,13 @@ doPickSplit(Relation index, SpGistState *state,
Page page = BufferGetPage(saveCurrent.buffer);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
PageSetLSN(current->page, recptr);
PageSetTLI(current->page, ThisTimeLineID);
if (parent->buffer != InvalidBuffer)
{
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);
PageSetLSN(current->page, recptr);
PageSetTLI(current->page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -1667,11 +1657,8 @@ spgAddNodeAction(Relation index, SpGistState *state,
/* we don't bother to check if any of these are redundant */
PageSetLSN(current->page, recptr);
PageSetTLI(current->page, ThisTimeLineID);
PageSetLSN(parent->page, recptr);
PageSetTLI(parent->page, ThisTimeLineID);
PageSetLSN(saveCurrent.page, recptr);
PageSetTLI(saveCurrent.page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -1831,12 +1818,10 @@ spgSplitNodeAction(Relation index, SpGistState *state,
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_SPLIT_TUPLE, rdata);
PageSetLSN(current->page, recptr);
PageSetTLI(current->page, ThisTimeLineID);
if (newBuffer != InvalidBuffer)
{
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);
PageSetLSN(BufferGetPage(metabuffer), recptr);
PageSetTLI(BufferGetPage(metabuffer), ThisTimeLineID);
PageSetLSN(BufferGetPage(rootbuffer), recptr);
PageSetTLI(BufferGetPage(rootbuffer), ThisTimeLineID);
PageSetLSN(BufferGetPage(nullbuffer), recptr);
PageSetTLI(BufferGetPage(nullbuffer), ThisTimeLineID);
}
END_CRIT_SECTION();
......
......@@ -392,7 +392,6 @@ vacuumLeafPage(spgBulkDeleteState *bds, Relation index, Buffer buffer,
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_LEAF, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -473,7 +472,6 @@ vacuumLeafRoot(spgBulkDeleteState *bds, Relation index, Buffer buffer)
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_ROOT, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -594,7 +592,6 @@ vacuumRedirectAndPlaceholder(Relation index, Buffer buffer)
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_REDIRECT, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......
......@@ -84,7 +84,6 @@ spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
page = (Page) BufferGetPage(buffer);
SpGistInitMetapage(page);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......@@ -93,7 +92,6 @@ spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
SpGistInitBuffer(buffer, SPGIST_LEAF);
page = (Page) BufferGetPage(buffer);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......@@ -102,7 +100,6 @@ spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
SpGistInitBuffer(buffer, SPGIST_LEAF | SPGIST_NULLS);
page = (Page) BufferGetPage(buffer);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
......@@ -171,7 +168,6 @@ spgRedoAddLeaf(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -198,7 +194,6 @@ spgRedoAddLeaf(XLogRecPtr lsn, XLogRecord *record)
xldata->blknoLeaf, xldata->offnumLeaf);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -264,7 +259,6 @@ spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -289,7 +283,6 @@ spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
toInsert[nInsert - 1]);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -316,7 +309,6 @@ spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
xldata->blknoDst, toInsert[nInsert - 1]);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -363,7 +355,6 @@ spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
innerTuple->size);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -413,7 +404,6 @@ spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
if (xldata->blknoParent != xldata->blknoNew)
{
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
}
MarkBufferDirty(buffer);
}
......@@ -464,7 +454,6 @@ spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
if (xldata->blknoParent != xldata->blkno)
{
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
}
MarkBufferDirty(buffer);
}
......@@ -506,7 +495,6 @@ spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
xldata->blknoNew, xldata->offnumNew);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -558,7 +546,6 @@ spgRedoSplitTuple(XLogRecPtr lsn, XLogRecord *record)
postfixTuple->size, xldata->offnumPostfix);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -588,7 +575,6 @@ spgRedoSplitTuple(XLogRecPtr lsn, XLogRecord *record)
xldata->offnumPostfix);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -764,13 +750,11 @@ spgRedoPickSplit(XLogRecPtr lsn, XLogRecord *record)
if (srcPage != NULL)
{
PageSetLSN(srcPage, lsn);
PageSetTLI(srcPage, ThisTimeLineID);
MarkBufferDirty(srcBuffer);
}
if (destPage != NULL)
{
PageSetLSN(destPage, lsn);
PageSetTLI(destPage, ThisTimeLineID);
MarkBufferDirty(destBuffer);
}
......@@ -807,7 +791,6 @@ spgRedoPickSplit(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -852,7 +835,6 @@ spgRedoPickSplit(XLogRecPtr lsn, XLogRecord *record)
xldata->blknoInner, xldata->offnumInner);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -943,7 +925,6 @@ spgRedoVacuumLeaf(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -977,7 +958,6 @@ spgRedoVacuumRoot(XLogRecPtr lsn, XLogRecord *record)
PageIndexMultiDelete(page, toDelete, xldata->nDelete);
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
......@@ -1060,7 +1040,6 @@ spgRedoVacuumRedirect(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
......
......@@ -439,13 +439,14 @@ critical section.)
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
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,
recptr = XLogInsert(rmgr_id, info, rdata);
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()
......@@ -489,7 +490,6 @@ standard replay-routine pattern for this case is
... initialize the page ...
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......@@ -523,7 +523,6 @@ The standard replay-routine pattern for this case is
... apply the change ...
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
......
......@@ -3188,7 +3188,6 @@ RestoreBackupBlock(XLogRecPtr lsn, XLogRecord *record, int block_index,
}
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(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);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -477,7 +476,6 @@ AlterSequence(AlterSeqStmt *stmt)
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -741,7 +739,6 @@ nextval_internal(Oid relid)
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
/* 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);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......@@ -1598,7 +1594,6 @@ seq_redo(XLogRecPtr lsn, XLogRecord *record)
elog(PANIC, "seq_redo: failed to add item to page");
PageSetLSN(localpage, lsn);
PageSetTLI(localpage, ThisTimeLineID);
memcpy(page, localpage, BufferGetPageSize(buffer));
MarkBufferDirty(buffer);
......
......@@ -876,7 +876,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
recptr = log_heap_freeze(onerel, buf, FreezeLimit,
MultiXactFrzLimit, frozen, nfrozen);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
}
......@@ -1171,7 +1170,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
unused, uncnt,
vacrelstats->latestRemovedXid);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
......
......@@ -103,7 +103,7 @@ typedef struct
* space management information generic to any 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_lower - offset to start 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:
* "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.
* 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
* like a good idea).
*
* pd_checksum stores the page checksum, if it has been set for this page;
* 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
* useful. It is currently unused in index pages.
......@@ -138,10 +146,9 @@ typedef struct
typedef struct PageHeaderData
{
/* 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 */
uint16 pd_tli; /* least significant bits of the TimeLineID
* containing the LSN */
uint16 pd_checksum; /* checksum */
uint16 pd_flags; /* flag bits, see below */
LocationIndex pd_lower; /* offset to start of free space */
LocationIndex pd_upper; /* offset to end of free space */
......@@ -335,12 +342,6 @@ typedef PageHeaderData *PageHeader;
#define PageSetLSN(page, 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) \
(((PageHeader) (page))->pd_flags & PD_HAS_FREE_LINES)
#define PageSetHasFreeLinePointers(page) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment