diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2013-04-08 08:52:39 +0100 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2013-04-08 08:52:39 +0100 |
commit | 47c4333189c9eb5ac1f95adc90213e61996f53c4 (patch) | |
tree | cb66f513c3c2932cae1e97034585a4448184383f /src/backend/storage/buffer/bufmgr.c | |
parent | a4b94b85156192b839a3c840f8aaf0cf8699a8c8 (diff) | |
download | postgresql-47c4333189c9eb5ac1f95adc90213e61996f53c4.tar.gz postgresql-47c4333189c9eb5ac1f95adc90213e61996f53c4.zip |
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/storage/buffer/bufmgr.c')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index c2ef53f4617..1c414281ae5 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -2682,8 +2682,8 @@ MarkBufferDirtyHint(Buffer buffer) * as long as we serialise it somehow we're OK. We choose to * set LSN while holding the buffer header lock, which causes * any reader of an LSN who holds only a share lock to also - * obtain a buffer header lock before using PageGetLSN(). - * Fortunately, thats not too many places. + * obtain a buffer header lock before using PageGetLSN(), + * which is enforced in BufferGetLSNAtomic(). * * If checksums are enabled, you might think we should reset the * checksum here. That will happen when the page is written |