aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2013-06-17 08:02:12 -0700
committerJeff Davis <jdavis@postgresql.org>2013-06-17 08:02:12 -0700
commitb8fd1a09f382f04c41128fded4d56da2127ce92d (patch)
treee84773ab67d8daf81c5260e36086e727cdeec707 /src/backend/access/transam/xlog.c
parent2bc4ab4f9c2ed8d94c22c41fce05f97838f2fc42 (diff)
downloadpostgresql-b8fd1a09f382f04c41128fded4d56da2127ce92d.tar.gz
postgresql-b8fd1a09f382f04c41128fded4d56da2127ce92d.zip
Add buffer_std flag to MarkBufferDirtyHint().
MarkBufferDirtyHint() writes WAL, and should know if it's got a standard buffer or not. Currently, the only callers where buffer_std is false are related to the FSM. In passing, rename XLOG_HINT to XLOG_FPI, which is more descriptive. Back-patch to 9.3.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 654c9c18d8b..9f858995d12 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7681,12 +7681,9 @@ XLogRestorePoint(const char *rpName)
* 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;
@@ -7708,7 +7705,7 @@ XLogSaveBufferForHint(Buffer buffer)
* 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.
@@ -7722,6 +7719,9 @@ XLogSaveBufferForHint(Buffer buffer)
* 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,
@@ -7744,7 +7744,7 @@ XLogSaveBufferForHint(Buffer buffer)
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;
@@ -8109,14 +8109,14 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
{
/* 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.
*