[COMMITTERS] pgsql: Remove _hash_wrtbuf() in favor of calling MarkBufferDirty(). - Mailing list pgsql-committers

From Robert Haas
Subject [COMMITTERS] pgsql: Remove _hash_wrtbuf() in favor of calling MarkBufferDirty().
Date
Msg-id E1cHtkP-00052i-Cj@gemulon.postgresql.org
Whole thread Raw
List pgsql-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(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: [COMMITTERS] pgsql: Fix off-by-one in memory allocation for quote_literal_cstr().
Next
From: Robert Haas
Date:
Subject: [COMMITTERS] pgsql: Fix more hash index bugs around marking buffers dirty.