pgsql: Avoid tricky race condition recording XLOG_HINT

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid tricky race condition recording XLOG_HINT
Date: 2013-04-08 07:57:23
Message-ID: E1UP6x9-0005JB-N0@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/47c4333189c9eb5ac1f95adc90213e61996f53c4

Modified Files
--------------
src/backend/access/rmgrdesc/xlogdesc.c | 6 +-
src/backend/access/transam/xlog.c | 232 +++++++++++++++++++-------------
src/backend/storage/buffer/bufmgr.c | 4 +-
src/include/catalog/catversion.h | 2 +-
4 files changed, 144 insertions(+), 100 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Thom Brown 2013-04-08 07:59:17 Re: pgsql: README comments on checksums on page holes.
Previous Message Simon Riggs 2013-04-08 07:44:26 pgsql: README comments on checksums on page holes.