pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Remove _hash_wrtbuf() in favor of calling MarkBufferDirty().
Date: Fri, 16 Dec 2016 14:44:33 +0000
Message-ID: <E1cHtkP-00052i-Cj@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Remove _hash_wrtbuf() in favor of calling MarkBufferDirty().

The whole concept of _hash_wrtbuf() is that we need to know at the
time we're releasing the buffer lock (and pin) whether we dirtied the
buffer, but this is easy to get wrong.  This patch actually fixes one
non-obvious bug of that form: hashbucketcleanup forgot to signal
_hash_squeezebucket, which gets the primary bucket page already
locked, as to whether it had already dirtied the page.  Calling
MarkBufferDirty() at the places where we dirty the buffer is more
intuitive and lets us simplify the code in various places as well.

On top of all that, the ultimate goal here is to make hash indexes
WAL-logged, and as the comments to _hash_wrtbuf() note, it should
go away when that happens.  Making it go away a little earlier than
that seems like a good preparatory step.

Report by Jeff Janes.  Diagnosis by Amit Kapila, Kuntal Ghosh,
and Dilip Kumar.  Patch by me, after studying an alternative patch
submitted by Amit Kapila.

Discussion: http://postgr.es/m/CAA4eK1Kf6tOY0oVz_SEdngiNFkeXrA3xUSDPPORQvsWVPdKqnA@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/25216c98938495fd741bf585dcbef45b3a9ffd40

Modified Files
--------------
src/backend/access/hash/hash.c       | 19 +++++---------
src/backend/access/hash/hashinsert.c |  5 ++--
src/backend/access/hash/hashovfl.c   | 49 ++++++++++++++++++------------------
src/backend/access/hash/hashpage.c   | 30 ++++++----------------
src/include/access/hash.h            |  1 -
5 files changed, 41 insertions(+), 63 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1cHtkP-00052i-Cj@gemulon.postgresql.org>
Permalink:  ../E1cHtkP-00052i-Cj@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cHtkP-00052i-Cj@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org
  Subject: Re: pgsql: Remove _hash_wrtbuf() in favor of calling MarkBufferDirty().
  In-Reply-To: <E1cHtkP-00052i-Cj@gemulon.postgresql.org>
  References: <E1cHtkP-00052i-Cj@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox