@@ -6921,133 +6921,6 @@ log_heap_update(Relation reln, Buffer oldbuf,
69216921 return recptr ;
69226922}
69236923
6924- /*
6925- * Perform XLogInsert of a HEAP_NEWPAGE record to WAL. Caller is responsible
6926- * for writing the page to disk after calling this routine.
6927- *
6928- * Note: If you're using this function, you should be building pages in private
6929- * memory and writing them directly to smgr. If you're using buffers, call
6930- * log_newpage_buffer instead.
6931- *
6932- * If the page follows the standard page layout, with a PageHeader and unused
6933- * space between pd_lower and pd_upper, set 'page_std' to TRUE. That allows
6934- * the unused space to be left out from the WAL record, making it smaller.
6935- */
6936- XLogRecPtr
6937- log_newpage (RelFileNode * rnode , ForkNumber forkNum , BlockNumber blkno ,
6938- Page page , bool page_std )
6939- {
6940- xl_heap_newpage xlrec ;
6941- XLogRecPtr recptr ;
6942- XLogRecData rdata [3 ];
6943-
6944- /*
6945- * Note: the NEWPAGE log record is used for both heaps and indexes, so do
6946- * not do anything that assumes we are touching a heap.
6947- */
6948-
6949- /* NO ELOG(ERROR) from here till newpage op is logged */
6950- START_CRIT_SECTION ();
6951-
6952- xlrec .node = * rnode ;
6953- xlrec .forknum = forkNum ;
6954- xlrec .blkno = blkno ;
6955-
6956- if (page_std )
6957- {
6958- /* Assume we can omit data between pd_lower and pd_upper */
6959- uint16 lower = ((PageHeader ) page )-> pd_lower ;
6960- uint16 upper = ((PageHeader ) page )-> pd_upper ;
6961-
6962- if (lower >= SizeOfPageHeaderData &&
6963- upper > lower &&
6964- upper <= BLCKSZ )
6965- {
6966- xlrec .hole_offset = lower ;
6967- xlrec .hole_length = upper - lower ;
6968- }
6969- else
6970- {
6971- /* No "hole" to compress out */
6972- xlrec .hole_offset = 0 ;
6973- xlrec .hole_length = 0 ;
6974- }
6975- }
6976- else
6977- {
6978- /* Not a standard page header, don't try to eliminate "hole" */
6979- xlrec .hole_offset = 0 ;
6980- xlrec .hole_length = 0 ;
6981- }
6982-
6983- rdata [0 ].data = (char * ) & xlrec ;
6984- rdata [0 ].len = SizeOfHeapNewpage ;
6985- rdata [0 ].buffer = InvalidBuffer ;
6986- rdata [0 ].next = & (rdata [1 ]);
6987-
6988- if (xlrec .hole_length == 0 )
6989- {
6990- rdata [1 ].data = (char * ) page ;
6991- rdata [1 ].len = BLCKSZ ;
6992- rdata [1 ].buffer = InvalidBuffer ;
6993- rdata [1 ].next = NULL ;
6994- }
6995- else
6996- {
6997- /* must skip the hole */
6998- rdata [1 ].data = (char * ) page ;
6999- rdata [1 ].len = xlrec .hole_offset ;
7000- rdata [1 ].buffer = InvalidBuffer ;
7001- rdata [1 ].next = & rdata [2 ];
7002-
7003- rdata [2 ].data = (char * ) page + (xlrec .hole_offset + xlrec .hole_length );
7004- rdata [2 ].len = BLCKSZ - (xlrec .hole_offset + xlrec .hole_length );
7005- rdata [2 ].buffer = InvalidBuffer ;
7006- rdata [2 ].next = NULL ;
7007- }
7008-
7009- recptr = XLogInsert (RM_HEAP_ID , XLOG_HEAP_NEWPAGE , rdata );
7010-
7011- /*
7012- * The page may be uninitialized. If so, we can't set the LSN because that
7013- * would corrupt the page.
7014- */
7015- if (!PageIsNew (page ))
7016- {
7017- PageSetLSN (page , recptr );
7018- }
7019-
7020- END_CRIT_SECTION ();
7021-
7022- return recptr ;
7023- }
7024-
7025- /*
7026- * Perform XLogInsert of a HEAP_NEWPAGE record to WAL.
7027- *
7028- * Caller should initialize the buffer and mark it dirty before calling this
7029- * function. This function will set the page LSN and TLI.
7030- *
7031- * If the page follows the standard page layout, with a PageHeader and unused
7032- * space between pd_lower and pd_upper, set 'page_std' to TRUE. That allows
7033- * the unused space to be left out from the WAL record, making it smaller.
7034- */
7035- XLogRecPtr
7036- log_newpage_buffer (Buffer buffer , bool page_std )
7037- {
7038- Page page = BufferGetPage (buffer );
7039- RelFileNode rnode ;
7040- ForkNumber forkNum ;
7041- BlockNumber blkno ;
7042-
7043- /* Shared buffers should be modified in a critical section. */
7044- Assert (CritSectionCount > 0 );
7045-
7046- BufferGetTag (buffer , & rnode , & forkNum , & blkno );
7047-
7048- return log_newpage (& rnode , forkNum , blkno , page , page_std );
7049- }
7050-
70516924/*
70526925 * Perform XLogInsert of a XLOG_HEAP2_NEW_CID record
70536926 *
@@ -7515,56 +7388,6 @@ heap_xlog_freeze_page(XLogRecPtr lsn, XLogRecord *record)
75157388 UnlockReleaseBuffer (buffer );
75167389}
75177390
7518- static void
7519- heap_xlog_newpage (XLogRecPtr lsn , XLogRecord * record )
7520- {
7521- xl_heap_newpage * xlrec = (xl_heap_newpage * ) XLogRecGetData (record );
7522- char * blk = ((char * ) xlrec ) + sizeof (xl_heap_newpage );
7523- Buffer buffer ;
7524- Page page ;
7525-
7526- /* Backup blocks are not used in newpage records */
7527- Assert (!(record -> xl_info & XLR_BKP_BLOCK_MASK ));
7528-
7529- Assert (record -> xl_len == SizeOfHeapNewpage + BLCKSZ - xlrec -> hole_length );
7530-
7531- /*
7532- * Note: the NEWPAGE log record is used for both heaps and indexes, so do
7533- * not do anything that assumes we are touching a heap.
7534- */
7535- buffer = XLogReadBufferExtended (xlrec -> node , xlrec -> forknum , xlrec -> blkno ,
7536- RBM_ZERO );
7537- Assert (BufferIsValid (buffer ));
7538- LockBuffer (buffer , BUFFER_LOCK_EXCLUSIVE );
7539- page = (Page ) BufferGetPage (buffer );
7540-
7541- if (xlrec -> hole_length == 0 )
7542- {
7543- memcpy ((char * ) page , blk , BLCKSZ );
7544- }
7545- else
7546- {
7547- memcpy ((char * ) page , blk , xlrec -> hole_offset );
7548- /* must zero-fill the hole */
7549- MemSet ((char * ) page + xlrec -> hole_offset , 0 , xlrec -> hole_length );
7550- memcpy ((char * ) page + (xlrec -> hole_offset + xlrec -> hole_length ),
7551- blk + xlrec -> hole_offset ,
7552- BLCKSZ - (xlrec -> hole_offset + xlrec -> hole_length ));
7553- }
7554-
7555- /*
7556- * The page may be uninitialized. If so, we can't set the LSN because that
7557- * would corrupt the page.
7558- */
7559- if (!PageIsNew (page ))
7560- {
7561- PageSetLSN (page , lsn );
7562- }
7563-
7564- MarkBufferDirty (buffer );
7565- UnlockReleaseBuffer (buffer );
7566- }
7567-
75687391/*
75697392 * Given an "infobits" field from an XLog record, set the correct bits in the
75707393 * given infomask and infomask2 for the tuple touched by the record.
@@ -8421,9 +8244,6 @@ heap_redo(XLogRecPtr lsn, XLogRecord *record)
84218244 case XLOG_HEAP_HOT_UPDATE :
84228245 heap_xlog_update (lsn , record , true);
84238246 break ;
8424- case XLOG_HEAP_NEWPAGE :
8425- heap_xlog_newpage (lsn , record );
8426- break ;
84278247 case XLOG_HEAP_LOCK :
84288248 heap_xlog_lock (lsn , record );
84298249 break ;
0 commit comments