index 5ca27a231e2798d895077d5f0d214955fe77c1cb..8895f585034e5e0104d0c64e8e171144a4c3e037 100644 (file)
/*
* Since this can be redone later if needed, mark as a hint.
*/
- MarkBufferDirtyHint(buf);
+ MarkBufferDirtyHint(buf, true);
}
/*
index 2ab723ddf196c6d6925e10b19df647a0cdfd80bb..c6e31542935b79089f26dbde069d4a29b71421f6 100644 (file)
@@ -262,7 +262,7 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
{
((PageHeader) page)->pd_prune_xid = prstate.new_prune_xid;
PageClearFull(page);
- MarkBufferDirtyHint(buffer);
+ MarkBufferDirtyHint(buffer, true);
}
}
index 6ad4f765f5bb335d91bd5c15e62d3670364c86e5..a452fea841077593b7193771296aa36b443c18e7 100644 (file)
@@ -413,9 +413,9 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
* crucial. Be sure to mark the proper buffer dirty.
*/
if (nbuf != InvalidBuffer)
- MarkBufferDirtyHint(nbuf);
+ MarkBufferDirtyHint(nbuf, true);
else
- MarkBufferDirtyHint(buf);
+ MarkBufferDirtyHint(buf, true);
}
}
}
index 621b0556390f1c27d3b268f01033e6c393d6fdcc..073190ffd53c276086a238685631cbafe6bcad1c 100644 (file)
opaque->btpo_cycleid == vstate->cycleid)
{
opaque->btpo_cycleid = 0;
- MarkBufferDirtyHint(buf);
+ MarkBufferDirtyHint(buf, true);
}
}
index fe53ec1fe0a1eb8887daeea4846840445c3555c4..352c77cbea2a836c4657039638176eb5f0b30cac 100644 (file)
@@ -1789,7 +1789,7 @@ _bt_killitems(IndexScanDesc scan, bool haveLock)
if (killedsomething)
{
opaque->btpo_flags |= BTP_HAS_GARBAGE;
- MarkBufferDirtyHint(so->currPos.buf);
+ MarkBufferDirtyHint(so->currPos.buf, true);
}
if (!haveLock)
index 2bad52748a35608e015cf48dcca58a262d521509..12370521d453beeda4f6e8aa42240bfed26e6e76 100644 (file)
@@ -82,11 +82,11 @@ xlog_desc(StringInfo buf, uint8 xl_info, char *rec)
appendStringInfo(buf, "restore point: %s", xlrec->rp_name);
}
- else if (info == XLOG_HINT)
+ else if (info == XLOG_FPI)
{
BkpBlock *bkp = (BkpBlock *) rec;
- appendStringInfo(buf, "page hint: %s block %u",
+ appendStringInfo(buf, "full-page image: %s block %u",
relpathperm(bkp->node, bkp->fork),
bkp->block);
}
index 654c9c18d8ba0168c44c81e428b5c26731921a8d..9f858995d1218137465eba78689a3daef963dfb8 100644 (file)
* records. In that case, multiple copies of the same block would be recorded
* in separate WAL records by different backends, though that is still OK from
* a correctness perspective.
- *
- * Note that this only works for buffers that fit the standard page model,
- * i.e. those for which buffer_std == true
*/
XLogRecPtr
-XLogSaveBufferForHint(Buffer buffer)
+XLogSaveBufferForHint(Buffer buffer, bool buffer_std)
{
XLogRecPtr recptr = InvalidXLogRecPtr;
XLogRecPtr lsn;
* and reset rdata for any actual WAL record insert.
*/
rdata[0].buffer = buffer;
- rdata[0].buffer_std = true;
+ rdata[0].buffer_std = buffer_std;
/*
* Check buffer while not holding an exclusive lock.
* Copy buffer so we don't have to worry about concurrent hint bit or
* lsn updates. We assume pd_lower/upper cannot be changed without an
* exclusive lock, so the contents bkp are not racy.
+ *
+ * With buffer_std set to false, XLogCheckBuffer() sets hole_length and
+ * hole_offset to 0; so the following code is safe for either case.
*/
memcpy(copied_buffer, origdata, bkpb.hole_offset);
memcpy(copied_buffer + bkpb.hole_offset,
rdata[1].buffer = InvalidBuffer;
rdata[1].next = NULL;
- recptr = XLogInsert(RM_XLOG_ID, XLOG_HINT, rdata);
+ recptr = XLogInsert(RM_XLOG_ID, XLOG_FPI, rdata);
}
return recptr;
{
/* nothing to do here */
}
- else if (info == XLOG_HINT)
+ else if (info == XLOG_FPI)
{
char *data;
BkpBlock bkpb;
/*
- * Hint bit records contain a backup block stored "inline" in the
- * normal data since the locking when writing hint records isn't
+ * Full-page image (FPI) records contain a backup block stored "inline"
+ * in the normal data since the locking when writing hint records isn't
* sufficient to use the normal backup block mechanism, which assumes
* exclusive lock on the buffer supplied.
*
index bffc12ed0e982895ca9fbb372879cde85ef7d2f1..ddfaf3bd293a9114de59a59aefc656e40b47761d 100644 (file)
@@ -1118,7 +1118,7 @@ read_seq_tuple(SeqTable elm, Relation rel, Buffer *buf, HeapTuple seqtuple)
HeapTupleHeaderSetXmax(seqtuple->t_data, InvalidTransactionId);
seqtuple->t_data->t_infomask &= ~HEAP_XMAX_COMMITTED;
seqtuple->t_data->t_infomask |= HEAP_XMAX_INVALID;
- MarkBufferDirtyHint(*buf);
+ MarkBufferDirtyHint(*buf, true);
}
seq = (Form_pg_sequence) GETSTRUCT(seqtuple);
index c6b033cf417f8b8d64fd487a32fa36d8fbd6c1cb..8079226864daa3236c29d2abe7ba0ad41a65401c 100644 (file)
* (due to a race condition), so it cannot be used for important changes.
*/
void
-MarkBufferDirtyHint(Buffer buffer)
+MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
{
volatile BufferDesc *bufHdr;
Page page = BufferGetPage(buffer);
* rather than full transactionids.
*/
MyPgXact->delayChkpt = delayChkpt = true;
- lsn = XLogSaveBufferForHint(buffer);
+ lsn = XLogSaveBufferForHint(buffer, buffer_std);
}
LockBufHdr(bufHdr);
index b76bf9be6b416117f69db651e0f23cf4f08c4019..b15cf8fe452b318c1d13c5002bd54e96139dcf3b 100644 (file)
@@ -216,7 +216,7 @@ XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk,
PageInit(page, BLCKSZ, 0);
if (fsm_set_avail(page, slot, new_cat))
- MarkBufferDirtyHint(buf);
+ MarkBufferDirtyHint(buf, false);
UnlockReleaseBuffer(buf);
}
@@ -286,7 +286,7 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
return; /* nothing to do; the FSM was already smaller */
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
fsm_truncate_avail(BufferGetPage(buf), first_removed_slot);
- MarkBufferDirtyHint(buf);
+ MarkBufferDirtyHint(buf, false);
UnlockReleaseBuffer(buf);
new_nfsmblocks = fsm_logical_to_physical(first_removed_address) + 1;
@@ -619,7 +619,7 @@ fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot,
page = BufferGetPage(buf);
if (fsm_set_avail(page, slot, newValue))
- MarkBufferDirtyHint(buf);
+ MarkBufferDirtyHint(buf, false);
if (minValue != 0)
{
@@ -770,7 +770,7 @@ fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof_p)
{
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
fsm_set_avail(BufferGetPage(buf), slot, child_avail);
- MarkBufferDirtyHint(buf);
+ MarkBufferDirtyHint(buf, false);
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
}
}
index 19c8e09148b03b1fd85f080b59314fd6b3ed8969..8376a7fc0f839a63eea385c556600e1e77c26767 100644 (file)
exclusive_lock_held = true;
}
fsm_rebuild_page(page);
- MarkBufferDirtyHint(buf);
+ MarkBufferDirtyHint(buf, false);
goto restart;
}
}
index ab4020a710b425642224a1f35c6af968854a5dca..55563ea335d8deaf505084d50b9f18180d3e1de5 100644 (file)
@@ -121,7 +121,7 @@ SetHintBits(HeapTupleHeader tuple, Buffer buffer,
}
tuple->t_infomask |= infomask;
- MarkBufferDirtyHint(buffer);
+ MarkBufferDirtyHint(buffer, true);
}
/*
index b4a75cee22015b7a6c56c522a6c88b7696995420..83e583259dd39ec0ad8fceacade42e082efeecc0 100644 (file)
@@ -267,7 +267,7 @@ extern bool XLogNeedsFlush(XLogRecPtr RecPtr);
extern int XLogFileInit(XLogSegNo segno, bool *use_existent, bool use_lock);
extern int XLogFileOpen(XLogSegNo segno);
-extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer);
+extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std);
extern void CheckXLogRemoved(XLogSegNo segno, TimeLineID tli);
extern void XLogSetAsyncXactLSN(XLogRecPtr record);
index 4f154a95892772190063448fa859cb22c9a2b17f..0e297610d8a526847b260ea31db28f54056a1023 100644 (file)
#define XLOG_RESTORE_POINT 0x70
#define XLOG_FPW_CHANGE 0x80
#define XLOG_END_OF_RECOVERY 0x90
-#define XLOG_HINT 0xA0
+#define XLOG_FPI 0xA0
/*
index 9be18608426c0315c820b91438bc4f78f941859a..6dc031ead544375cb6768c71bb65236db601f6b8 100644 (file)
extern void BufferGetTag(Buffer buffer, RelFileNode *rnode,
ForkNumber *forknum, BlockNumber *blknum);
-extern void MarkBufferDirtyHint(Buffer buffer);
+extern void MarkBufferDirtyHint(Buffer buffer, bool buffer_std);
extern void UnlockBuffers(void);
extern void LockBuffer(Buffer buffer, int mode);