pgsql: Documentation improvement and minor code cleanups for the latch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Documentation improvement and minor code cleanups for the latch
Date: 2011-08-09 19:31:07
Message-ID: E1Qqs15-00049w-6w@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Documentation improvement and minor code cleanups for the latch facility.

Improve the documentation around weak-memory-ordering risks, and do a pass
of general editorialization on the comments in the latch code. Make the
Windows latch code more like the Unix latch code where feasible; in
particular provide the same Assert checks in both implementations.
Fix poorly-placed WaitLatch call in syncrep.c.

This patch resolves, for the moment, concerns around weak-memory-ordering
bugs in latch-related code: we have documented the restrictions and checked
that existing calls meet them. In 9.2 I hope that we will install suitable
memory barrier instructions in SetLatch/ResetLatch, so that their callers
don't need to be quite so careful.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/6760a4d4029121981bf3ec24847ddfbacecc070d

Modified Files
--------------
src/backend/port/unix_latch.c | 149 ++++++++++++++++++-------------------
src/backend/port/win32_latch.c | 25 +++---
src/backend/replication/syncrep.c | 20 +++--
src/backend/storage/lmgr/proc.c | 2 +-
src/include/storage/latch.h | 69 ++++++++++++++++-
5 files changed, 163 insertions(+), 102 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-08-09 22:52:57 pgsql: Measure WaitLatch's timeout parameter in milliseconds, not micro
Previous Message Tom Lane 2011-08-09 15:34:28 pgsql: Avoid creating PlaceHolderVars immediately within PlaceHolderVar