*** a/contrib/pageinspect/Makefile
--- b/contrib/pageinspect/Makefile
***************
*** 4,10 **** MODULE_big = pageinspect
OBJS = rawpage.o heapfuncs.o btreefuncs.o fsmfuncs.o
EXTENSION = pageinspect
! DATA = pageinspect--1.0.sql pageinspect--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
--- 4,11 ----
OBJS = rawpage.o heapfuncs.o btreefuncs.o fsmfuncs.o
EXTENSION = pageinspect
! 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
*** /dev/null
--- b/contrib/pageinspect/pageinspect--1.0--1.1.sql
***************
*** 0 ****
--- 1,18 ----
+ /* contrib/pageinspect/pageinspect--1.0--1.1.sql */
+
+ -- complain if script is sourced in psql, rather than via ALTER EXTENSION UPDATE
+ \echo Use "ALTER EXTENSION pageinspect UPDATE TO 1.1" to load this file. \quit
+
+ DROP FUNCTION page_header(bytea);
+ CREATE FUNCTION page_header(IN page bytea,
+ OUT lsn text,
+ OUT checksum smallint,
+ OUT flags smallint,
+ OUT lower smallint,
+ OUT upper smallint,
+ OUT special smallint,
+ OUT pagesize smallint,
+ OUT version smallint,
+ OUT prune_xid xid)
+ AS 'MODULE_PATHNAME', 'page_header'
+ LANGUAGE C STRICT;
*** /dev/null
--- b/contrib/pageinspect/pageinspect--1.1.sql
***************
*** 0 ****
--- 1,107 ----
+ /* contrib/pageinspect/pageinspect--1.1.sql */
+
+ -- complain if script is sourced in psql, rather than via CREATE EXTENSION
+ \echo Use "CREATE EXTENSION pageinspect" to load this file. \quit
+
+ --
+ -- get_raw_page()
+ --
+ CREATE FUNCTION get_raw_page(text, int4)
+ RETURNS bytea
+ AS 'MODULE_PATHNAME', 'get_raw_page'
+ LANGUAGE C STRICT;
+
+ CREATE FUNCTION get_raw_page(text, text, int4)
+ RETURNS bytea
+ AS 'MODULE_PATHNAME', 'get_raw_page_fork'
+ LANGUAGE C STRICT;
+
+ --
+ -- page_header()
+ --
+ CREATE FUNCTION page_header(IN page bytea,
+ OUT lsn text,
+ OUT checksum smallint,
+ OUT flags smallint,
+ OUT lower smallint,
+ OUT upper smallint,
+ OUT special smallint,
+ OUT pagesize smallint,
+ OUT version smallint,
+ OUT prune_xid xid)
+ AS 'MODULE_PATHNAME', 'page_header'
+ LANGUAGE C STRICT;
+
+ --
+ -- heap_page_items()
+ --
+ CREATE FUNCTION heap_page_items(IN page bytea,
+ OUT lp smallint,
+ OUT lp_off smallint,
+ OUT lp_flags smallint,
+ OUT lp_len smallint,
+ OUT t_xmin xid,
+ OUT t_xmax xid,
+ OUT t_field3 int4,
+ OUT t_ctid tid,
+ OUT t_infomask2 integer,
+ OUT t_infomask integer,
+ OUT t_hoff smallint,
+ OUT t_bits text,
+ OUT t_oid oid)
+ RETURNS SETOF record
+ AS 'MODULE_PATHNAME', 'heap_page_items'
+ LANGUAGE C STRICT;
+
+ --
+ -- bt_metap()
+ --
+ CREATE FUNCTION bt_metap(IN relname text,
+ OUT magic int4,
+ OUT version int4,
+ OUT root int4,
+ OUT level int4,
+ OUT fastroot int4,
+ OUT fastlevel int4)
+ AS 'MODULE_PATHNAME', 'bt_metap'
+ LANGUAGE C STRICT;
+
+ --
+ -- bt_page_stats()
+ --
+ CREATE FUNCTION bt_page_stats(IN relname text, IN blkno int4,
+ OUT blkno int4,
+ OUT type "char",
+ OUT live_items int4,
+ OUT dead_items int4,
+ OUT avg_item_size int4,
+ OUT page_size int4,
+ OUT free_size int4,
+ OUT btpo_prev int4,
+ OUT btpo_next int4,
+ OUT btpo int4,
+ OUT btpo_flags int4)
+ AS 'MODULE_PATHNAME', 'bt_page_stats'
+ LANGUAGE C STRICT;
+
+ --
+ -- bt_page_items()
+ --
+ CREATE FUNCTION bt_page_items(IN relname text, IN blkno int4,
+ OUT itemoffset smallint,
+ OUT ctid tid,
+ OUT itemlen smallint,
+ OUT nulls bool,
+ OUT vars bool,
+ OUT data text)
+ RETURNS SETOF record
+ AS 'MODULE_PATHNAME', 'bt_page_items'
+ LANGUAGE C STRICT;
+
+ --
+ -- fsm_page_contents()
+ --
+ CREATE FUNCTION fsm_page_contents(IN page bytea)
+ RETURNS text
+ AS 'MODULE_PATHNAME', 'fsm_page_contents'
+ LANGUAGE C STRICT;
*** a/contrib/pageinspect/pageinspect.control
--- b/contrib/pageinspect/pageinspect.control
***************
*** 1,5 ****
# pageinspect extension
comment = 'inspect the contents of database pages at a low level'
! default_version = '1.0'
module_pathname = '$libdir/pageinspect'
relocatable = true
--- 1,5 ----
# pageinspect extension
comment = 'inspect the contents of database pages at a low level'
! default_version = '1.1'
module_pathname = '$libdir/pageinspect'
relocatable = true
*** a/contrib/pageinspect/rawpage.c
--- b/contrib/pageinspect/rawpage.c
***************
*** 211,217 **** page_header(PG_FUNCTION_ARGS)
(uint32) (lsn >> 32), (uint32) lsn);
values[0] = CStringGetTextDatum(lsnchar);
! values[1] = UInt16GetDatum(PageGetTLI(page));
values[2] = UInt16GetDatum(page->pd_flags);
values[3] = UInt16GetDatum(page->pd_lower);
values[4] = UInt16GetDatum(page->pd_upper);
--- 211,217 ----
(uint32) (lsn >> 32), (uint32) lsn);
values[0] = CStringGetTextDatum(lsnchar);
! values[1] = UInt16GetDatum(page->pd_checksum);
values[2] = UInt16GetDatum(page->pd_flags);
values[3] = UInt16GetDatum(page->pd_lower);
values[4] = UInt16GetDatum(page->pd_upper);
*** a/doc/src/sgml/pageinspect.sgml
--- b/doc/src/sgml/pageinspect.sgml
***************
*** 64,72 ****
passed as argument. For example:
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
The returned columns correspond to the fields in the
PageHeaderData> struct.
--- 64,72 ----
passed as argument. For example:
test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));
! lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid
! -----------+----------+--------+-------+-------+---------+----------+---------+-----------
! 0/1805DCC | -10748 | -32759 | 344 | 1232 | 8192 | 8192 | 4 | 0
The returned columns correspond to the fields in the
PageHeaderData> struct.
*** a/src/backend/access/gin/ginbtree.c
--- b/src/backend/access/gin/ginbtree.c
***************
*** 308,314 **** 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);
--- 308,313 ----
***************
*** 377,387 **** 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);
--- 376,383 ----
***************
*** 426,434 **** 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();
--- 422,428 ----
*** a/src/backend/access/gin/ginfast.c
--- b/src/backend/access/gin/ginfast.c
***************
*** 127,133 **** 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 */
--- 127,132 ----
***************
*** 408,419 **** 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);
}
}
--- 407,416 ----
***************
*** 594,606 **** 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);
}
}
--- 591,601 ----
*** a/src/backend/access/gin/gininsert.c
--- b/src/backend/access/gin/gininsert.c
***************
*** 84,90 **** 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);
--- 84,89 ----
***************
*** 431,441 **** ginbuild(PG_FUNCTION_ARGS)
page = BufferGetPage(RootBuffer);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
page = BufferGetPage(MetaBuffer);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
UnlockReleaseBuffer(MetaBuffer);
--- 430,438 ----
*** a/src/backend/access/gin/ginutil.c
--- b/src/backend/access/gin/ginutil.c
***************
*** 593,599 **** 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);
--- 593,598 ----
*** a/src/backend/access/gin/ginvacuum.c
--- b/src/backend/access/gin/ginvacuum.c
***************
*** 147,153 **** xlogVacuumPage(Relation index, Buffer buffer)
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_VACUUM_PAGE, rdata);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
static bool
--- 147,152 ----
***************
*** 350,363 **** 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);
}
}
--- 349,359 ----
*** a/src/backend/access/gin/ginxlog.c
--- b/src/backend/access/gin/ginxlog.c
***************
*** 87,93 **** ginRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
GinInitMetabuffer(MetaBuffer);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(MetaBuffer);
RootBuffer = XLogReadBuffer(*node, GIN_ROOT_BLKNO, true);
--- 87,92 ----
***************
*** 97,103 **** ginRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
GinInitBuffer(RootBuffer, GIN_LEAF);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(RootBuffer);
UnlockReleaseBuffer(RootBuffer);
--- 96,101 ----
***************
*** 124,130 **** ginRedoCreatePTree(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->maxoff = data->nitem;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
--- 122,127 ----
***************
*** 242,248 **** ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
--- 239,244 ----
***************
*** 333,343 **** 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)
--- 329,337 ----
***************
*** 362,368 **** ginRedoSplit(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(rootPage, lsn);
- PageSetTLI(rootPage, ThisTimeLineID);
MarkBufferDirty(rootBuf);
UnlockReleaseBuffer(rootBuf);
--- 356,361 ----
***************
*** 424,430 **** ginRedoVacuumPage(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
--- 417,422 ----
***************
*** 453,459 **** ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
Assert(GinPageIsData(page));
GinPageGetOpaque(page)->flags = GIN_DELETED;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(dbuffer);
}
}
--- 445,450 ----
***************
*** 473,479 **** ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
Assert(!GinPageIsLeaf(page));
GinPageDeletePostingItem(page, data->parentOffset);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(pbuffer);
}
}
--- 464,469 ----
***************
*** 492,498 **** ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
Assert(GinPageIsData(page));
GinPageGetOpaque(page)->rightlink = data->rightLink;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(lbuffer);
}
UnlockReleaseBuffer(lbuffer);
--- 482,487 ----
***************
*** 522,528 **** ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
{
memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
PageSetLSN(metapage, lsn);
- PageSetTLI(metapage, ThisTimeLineID);
MarkBufferDirty(metabuffer);
}
--- 511,516 ----
***************
*** 569,575 **** ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->maxoff++;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 557,562 ----
***************
*** 595,601 **** ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->rightlink = data->newRightlink;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 582,587 ----
***************
*** 655,661 **** ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
--- 641,646 ----
***************
*** 681,687 **** ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
{
memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
PageSetLSN(metapage, lsn);
- PageSetTLI(metapage, ThisTimeLineID);
MarkBufferDirty(metabuffer);
}
--- 666,671 ----
***************
*** 708,714 **** ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->flags = GIN_DELETED;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
--- 692,697 ----
*** a/src/backend/access/gist/gist.c
--- b/src/backend/access/gist/gist.c
***************
*** 396,402 **** gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
for (ptr = dist; ptr; ptr = ptr->next)
{
PageSetLSN(ptr->page, recptr);
- PageSetTLI(ptr->page, ThisTimeLineID);
}
/*
--- 396,401 ----
***************
*** 444,450 **** gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
leftchildbuf);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
else
{
--- 443,448 ----
***************
*** 477,483 **** gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
GistClearFollowRight(leftpg);
PageSetLSN(leftpg, recptr);
- PageSetTLI(leftpg, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 475,480 ----
*** a/src/backend/access/gist/gistbuild.c
--- b/src/backend/access/gist/gistbuild.c
***************
*** 201,207 **** gistbuild(PG_FUNCTION_ARGS)
recptr = XLogInsert(RM_GIST_ID, XLOG_GIST_CREATE_INDEX, &rdata);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
else
PageSetLSN(page, GetXLogRecPtrForTemp());
--- 201,206 ----
*** a/src/backend/access/gist/gistvacuum.c
--- b/src/backend/access/gist/gistvacuum.c
***************
*** 235,241 **** gistbulkdelete(PG_FUNCTION_ARGS)
todelete, ntodelete,
NULL, 0, InvalidBuffer);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
else
PageSetLSN(page, GetXLogRecPtrForTemp());
--- 235,240 ----
*** a/src/backend/access/gist/gistxlog.c
--- b/src/backend/access/gist/gistxlog.c
***************
*** 70,76 **** gistRedoClearFollowRight(XLogRecPtr lsn, XLogRecord *record, int block_index,
GistClearFollowRight(page);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 70,75 ----
***************
*** 185,191 **** gistRedoPageUpdateRecord(XLogRecPtr lsn, XLogRecord *record)
GistPageGetOpaque(page)->rightlink = InvalidBlockNumber;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
--- 184,189 ----
***************
*** 289,295 **** gistRedoPageSplitRecord(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
if (i == 0)
--- 287,292 ----
***************
*** 324,330 **** gistRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
GISTInitBuffer(buffer, F_LEAF);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
--- 321,326 ----
*** a/src/backend/access/heap/heapam.c
--- b/src/backend/access/heap/heapam.c
***************
*** 2129,2135 **** heap_insert(Relation relation, HeapTuple tup, CommandId cid,
recptr = XLogInsert(RM_HEAP_ID, info, rdata);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 2129,2134 ----
***************
*** 2425,2431 **** 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();
--- 2424,2429 ----
***************
*** 2786,2792 **** l1:
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_DELETE, rdata);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 2784,2789 ----
***************
*** 3546,3555 **** l2:
if (newbuf != buffer)
{
PageSetLSN(BufferGetPage(newbuf), recptr);
- PageSetTLI(BufferGetPage(newbuf), ThisTimeLineID);
}
PageSetLSN(BufferGetPage(buffer), recptr);
- PageSetTLI(BufferGetPage(buffer), ThisTimeLineID);
}
END_CRIT_SECTION();
--- 3543,3550 ----
***************
*** 4448,4454 **** failed:
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_LOCK, rdata);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 4443,4448 ----
***************
*** 5009,5015 **** 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();
--- 5003,5008 ----
***************
*** 5874,5880 **** log_newpage(RelFileNode *rnode, ForkNumber forkNum, BlockNumber blkno,
if (!PageIsNew(page))
{
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 5867,5872 ----
***************
*** 5923,5929 **** log_newpage_buffer(Buffer buffer)
if (!PageIsNew(page))
{
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
return recptr;
--- 5915,5920 ----
***************
*** 6025,6031 **** heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record)
*/
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
--- 6016,6021 ----
***************
*** 6093,6099 **** heap_xlog_freeze(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
--- 6083,6088 ----
***************
*** 6221,6233 **** 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.
*/
if (!PageIsNew(page))
{
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
}
MarkBufferDirty(buffer);
--- 6210,6221 ----
memcpy(page, (char *) xlrec + SizeOfHeapNewpage, BLCKSZ);
/*
! * 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);
}
MarkBufferDirty(buffer);
***************
*** 6333,6339 **** 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);
}
--- 6321,6326 ----
***************
*** 6432,6438 **** 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);
--- 6419,6424 ----
***************
*** 6579,6585 **** 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);
--- 6565,6570 ----
***************
*** 6721,6727 **** heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool hot_update)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(obuffer);
/* Deal with new tuple */
--- 6706,6711 ----
***************
*** 6820,6826 **** newsame:;
freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(nbuffer);
UnlockReleaseBuffer(nbuffer);
--- 6804,6809 ----
***************
*** 6895,6901 **** 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);
}
--- 6878,6883 ----
***************
*** 7001,7007 **** heap_xlog_inplace(XLogRecPtr lsn, XLogRecord *record)
newlen);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
--- 6983,6988 ----
*** a/src/backend/access/heap/pruneheap.c
--- b/src/backend/access/heap/pruneheap.c
***************
*** 244,250 **** heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
prstate.latestRemovedXid);
PageSetLSN(BufferGetPage(buffer), recptr);
- PageSetTLI(BufferGetPage(buffer), ThisTimeLineID);
}
}
else
--- 244,249 ----
*** a/src/backend/access/heap/visibilitymap.c
--- b/src/backend/access/heap/visibilitymap.c
***************
*** 274,280 **** 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();
--- 274,279 ----
*** a/src/backend/access/nbtree/nbtinsert.c
--- b/src/backend/access/nbtree/nbtinsert.c
***************
*** 850,860 **** _bt_insertonpg(Relation rel,
if (BufferIsValid(metabuf))
{
PageSetLSN(metapg, recptr);
- PageSetTLI(metapg, ThisTimeLineID);
}
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 850,858 ----
***************
*** 938,944 **** _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);
--- 936,941 ----
***************
*** 1311,1323 **** _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);
}
}
--- 1308,1317 ----
***************
*** 1953,1961 **** _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();
--- 1947,1953 ----
*** a/src/backend/access/nbtree/nbtpage.c
--- b/src/backend/access/nbtree/nbtpage.c
***************
*** 241,249 **** _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();
--- 241,247 ----
***************
*** 554,561 **** _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.
*/
}
--- 552,559 ----
XLogInsert(RM_BTREE_ID, XLOG_BTREE_REUSE_PAGE, rdata);
/*
! * We don't do PageSetLSN here because we're about initialise the page,
! * so no need.
*/
}
***************
*** 863,869 **** _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();
--- 861,866 ----
***************
*** 951,957 **** _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();
--- 948,953 ----
***************
*** 1533,1554 **** _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);
}
}
--- 1529,1545 ----
*** a/src/backend/access/nbtree/nbtsort.c
--- b/src/backend/access/nbtree/nbtsort.c
***************
*** 272,282 **** _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
--- 272,277 ----
*** a/src/backend/access/nbtree/nbtxlog.c
--- b/src/backend/access/nbtree/nbtxlog.c
***************
*** 186,192 **** _bt_restore_meta(RelFileNode rnode, XLogRecPtr lsn,
((char *) md + sizeof(BTMetaPageData)) - (char *) metapg;
PageSetLSN(metapg, lsn);
- PageSetTLI(metapg, ThisTimeLineID);
MarkBufferDirty(metabuf);
UnlockReleaseBuffer(metabuf);
}
--- 186,191 ----
***************
*** 241,247 **** 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);
}
--- 240,245 ----
***************
*** 358,364 **** 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 */
--- 356,361 ----
***************
*** 430,436 **** btree_xlog_split(bool onleft, bool isroot,
lopaque->btpo_cycleid = 0;
PageSetLSN(lpage, lsn);
- PageSetTLI(lpage, ThisTimeLineID);
MarkBufferDirty(lbuf);
}
--- 427,432 ----
***************
*** 466,472 **** btree_xlog_split(bool onleft, bool isroot,
pageop->btpo_prev = xlrec->rightsib;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 462,467 ----
***************
*** 563,569 **** btree_xlog_vacuum(XLogRecPtr lsn, XLogRecord *record)
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
--- 558,563 ----
***************
*** 780,786 **** btree_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
--- 774,779 ----
***************
*** 851,857 **** btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
--- 844,849 ----
***************
*** 877,883 **** btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
pageop->btpo_prev = leftsib;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
--- 869,874 ----
***************
*** 905,911 **** btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
pageop->btpo_next = rightsib;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
}
--- 896,901 ----
***************
*** 928,934 **** btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
pageop->btpo_cycleid = 0;
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
--- 918,923 ----
***************
*** 992,998 **** btree_xlog_newroot(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
--- 981,986 ----
*** a/src/backend/access/spgist/spgdoinsert.c
--- b/src/backend/access/spgist/spgdoinsert.c
***************
*** 308,320 **** 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);
}
}
--- 308,318 ----
***************
*** 548,558 **** 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();
--- 546,553 ----
***************
*** 1401,1407 **** doPickSplit(Relation index, SpGistState *state,
Page page = BufferGetPage(newLeafBuffer);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
if (saveCurrent.buffer != InvalidBuffer)
--- 1396,1401 ----
***************
*** 1409,1424 **** 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);
}
}
--- 1403,1415 ----
***************
*** 1557,1563 **** 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();
--- 1548,1553 ----
***************
*** 1667,1677 **** 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();
--- 1657,1664 ----
***************
*** 1831,1842 **** 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);
}
}
--- 1818,1827 ----
*** a/src/backend/access/spgist/spginsert.c
--- b/src/backend/access/spgist/spginsert.c
***************
*** 105,115 **** 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();
--- 105,112 ----
*** a/src/backend/access/spgist/spgvacuum.c
--- b/src/backend/access/spgist/spgvacuum.c
***************
*** 392,398 **** 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();
--- 392,397 ----
***************
*** 473,479 **** 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();
--- 472,477 ----
***************
*** 594,600 **** vacuumRedirectAndPlaceholder(Relation index, Buffer buffer)
recptr = XLogInsert(RM_SPGIST_ID, XLOG_SPGIST_VACUUM_REDIRECT, rdata);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 592,597 ----
*** a/src/backend/access/spgist/spgxlog.c
--- b/src/backend/access/spgist/spgxlog.c
***************
*** 84,90 **** spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
page = (Page) BufferGetPage(buffer);
SpGistInitMetapage(page);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
--- 84,89 ----
***************
*** 93,99 **** spgRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
SpGistInitBuffer(buffer, SPGIST_LEAF);
page = (Page) BufferGetPage(buffer);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
UnlockReleaseBuffer(buffer);
--- 92,97 ----
***************
*** 102,108 **** 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);
}
--- 100,105 ----
***************
*** 171,177 **** spgRedoAddLeaf(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 168,173 ----
***************
*** 198,204 **** spgRedoAddLeaf(XLogRecPtr lsn, XLogRecord *record)
xldata->blknoLeaf, xldata->offnumLeaf);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 194,199 ----
***************
*** 264,270 **** spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 259,264 ----
***************
*** 289,295 **** spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
toInsert[nInsert - 1]);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 283,288 ----
***************
*** 316,322 **** spgRedoMoveLeafs(XLogRecPtr lsn, XLogRecord *record)
xldata->blknoDst, toInsert[nInsert - 1]);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 309,314 ----
***************
*** 363,369 **** spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
innerTuple->size);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 355,360 ----
***************
*** 413,419 **** spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
if (xldata->blknoParent != xldata->blknoNew)
{
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
}
MarkBufferDirty(buffer);
}
--- 404,409 ----
***************
*** 464,470 **** spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
if (xldata->blknoParent != xldata->blkno)
{
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
}
MarkBufferDirty(buffer);
}
--- 454,459 ----
***************
*** 506,512 **** spgRedoAddNode(XLogRecPtr lsn, XLogRecord *record)
xldata->blknoNew, xldata->offnumNew);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 495,500 ----
***************
*** 558,564 **** spgRedoSplitTuple(XLogRecPtr lsn, XLogRecord *record)
postfixTuple->size, xldata->offnumPostfix);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 546,551 ----
***************
*** 588,594 **** spgRedoSplitTuple(XLogRecPtr lsn, XLogRecord *record)
xldata->offnumPostfix);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 575,580 ----
***************
*** 764,776 **** 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);
}
--- 750,760 ----
***************
*** 807,813 **** spgRedoPickSplit(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 791,796 ----
***************
*** 852,858 **** spgRedoPickSplit(XLogRecPtr lsn, XLogRecord *record)
xldata->blknoInner, xldata->offnumInner);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 835,840 ----
***************
*** 943,949 **** spgRedoVacuumLeaf(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 925,930 ----
***************
*** 977,983 **** spgRedoVacuumRoot(XLogRecPtr lsn, XLogRecord *record)
PageIndexMultiDelete(page, toDelete, xldata->nDelete);
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
UnlockReleaseBuffer(buffer);
--- 958,963 ----
***************
*** 1060,1066 **** spgRedoVacuumRedirect(XLogRecPtr lsn, XLogRecord *record)
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
}
--- 1040,1045 ----
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 3157,3163 **** RestoreBackupBlock(XLogRecPtr lsn, XLogRecord *record, int block_index,
}
PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
MarkBufferDirty(buffer);
if (!keep_buffer)
--- 3157,3162 ----
*** a/src/backend/commands/sequence.c
--- b/src/backend/commands/sequence.c
***************
*** 392,398 **** 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();
--- 392,397 ----
***************
*** 476,482 **** AlterSequence(AlterSeqStmt *stmt)
recptr = XLogInsert(RM_SEQ_ID, XLOG_SEQ_LOG, rdata);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 475,480 ----
***************
*** 738,744 **** 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 */
--- 736,741 ----
***************
*** 916,922 **** 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();
--- 913,918 ----
***************
*** 1595,1601 **** 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);
--- 1591,1596 ----
*** a/src/backend/commands/vacuumlazy.c
--- b/src/backend/commands/vacuumlazy.c
***************
*** 869,875 **** lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
recptr = log_heap_freeze(onerel, buf, FreezeLimit,
MultiXactFrzLimit, frozen, nfrozen);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
}
--- 869,874 ----
***************
*** 1142,1148 **** lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
unused, uncnt,
vacrelstats->latestRemovedXid);
PageSetLSN(page, recptr);
- PageSetTLI(page, ThisTimeLineID);
}
END_CRIT_SECTION();
--- 1141,1146 ----
*** a/src/include/storage/bufpage.h
--- b/src/include/storage/bufpage.h
***************
*** 103,109 **** typedef struct
* space management information generic to any page
*
* pd_lsn - identifies xlog record for last change to this page.
! * pd_tli - ditto.
* pd_flags - flag bits.
* pd_lower - offset to start of free space.
* pd_upper - offset to end of free space.
--- 103,109 ----
* space management information generic to any page
*
* pd_lsn - identifies xlog record for last change to this page.
! * pd_checksum - Fletcher checksum.
* pd_flags - flag bits.
* pd_lower - offset to start of free space.
* pd_upper - offset to end of free space.
***************
*** 114,122 **** 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_prune_xid is a hint field that helps determine whether pruning will be
* useful. It is currently unused in index pages.
--- 114,122 ----
* 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.
! *
! * pd_checksum hold a Fletcher checksum of the page number combined with the
! * page data.
*
* pd_prune_xid is a hint field that helps determine whether pruning will be
* useful. It is currently unused in index pages.
***************
*** 140,147 **** 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
* record for last change to this page */
! uint16 pd_tli; /* least significant bits of the TimeLineID
! * containing the LSN */
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 */
--- 140,146 ----
/* XXX LSN is member of *any* block, not only page-organized ones */
PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog
* record for last change to this page */
! uint16 pd_checksum; /* Fletcher 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,346 **** 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) \
--- 334,339 ----