summaryrefslogtreecommitdiff
path: root/src/backend/access/rmgrdesc
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2013-04-08 08:52:39 +0100
committerSimon Riggs <simon@2ndQuadrant.com>2013-04-08 08:52:39 +0100
commit47c4333189c9eb5ac1f95adc90213e61996f53c4 (patch)
treecb66f513c3c2932cae1e97034585a4448184383f /src/backend/access/rmgrdesc
parenta4b94b85156192b839a3c840f8aaf0cf8699a8c8 (diff)
downloadpostgresql-47c4333189c9eb5ac1f95adc90213e61996f53c4.tar.gz
Avoid tricky race condition recording XLOG_HINT
We copy the buffer before inserting an XLOG_HINT to avoid WAL CRC errors caused by concurrent hint writes to buffer while share locked. To make this work we refactor RestoreBackupBlock() to allow an XLOG_HINT to avoid the normal path for backup blocks, which assumes the underlying buffer is exclusive locked. Resulting code completely changes layout of XLOG_HINT WAL records, but this isn't even beta code, so this is a low impact change. In passing, avoid taking WALInsertLock for full page writes on checksummed hints, remove related cruft from XLogInsert() and improve xlog_desc record for XLOG_HINT. Andres Freund Bug report by Fujii Masao, testing by Jeff Janes and Jaime Casanova, review by Jeff Davis and Simon Riggs. Applied with changes from review and some comment editing.
Diffstat (limited to 'src/backend/access/rmgrdesc')
-rw-r--r--src/backend/access/rmgrdesc/xlogdesc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c
index 52cf759735..4c68b6ae0a 100644
--- a/src/backend/access/rmgrdesc/xlogdesc.c
+++ b/src/backend/access/rmgrdesc/xlogdesc.c
@@ -17,6 +17,7 @@
#include "access/xlog.h"
#include "access/xlog_internal.h"
#include "catalog/pg_control.h"
+#include "common/relpath.h"
#include "utils/guc.h"
#include "utils/timestamp.h"
@@ -83,7 +84,10 @@ xlog_desc(StringInfo buf, uint8 xl_info, char *rec)
}
else if (info == XLOG_HINT)
{
- appendStringInfo(buf, "page hint");
+ BkpBlock *bkp = (BkpBlock *) rec;
+ appendStringInfo(buf, "page hint: %s block %u",
+ relpathperm(bkp->node, bkp->fork),
+ bkp->block);
}
else if (info == XLOG_BACKUP_END)
{