pgsql: Fix building of large (bigger than shared_buffers) hash indexes.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix building of large (bigger than shared_buffers) hash indexes.
Date: 2016-06-24 20:57:47
Message-ID: E1bGYAd-0005KJ-77@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix building of large (bigger than shared_buffers) hash indexes.

When the index is predicted to need more than NBuffers buckets,
CREATE INDEX attempts to sort the index entries by hash key before
insertion, so as to reduce thrashing. This code path got broken by
commit 9f03ca915196dfc8, which overlooked that _hash_form_tuple() is not
just an alias for index_form_tuple(). The index got built anyway, but
with garbage data, so that searches for pre-existing tuples always
failed. Fix by refactoring to separate construction of the indexable
data from calling index_form_tuple().

Per bug #14210 from Daniel Newman. Back-patch to 9.5 where the
bug was introduced.

Report: <20160623162507(dot)17237(dot)39471(at)wrigleys(dot)postgresql(dot)org>

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/07f69137b15e594edfaec29f73efa86aa442902c

Modified Files
--------------
src/backend/access/hash/hash.c | 34 +++++++++++++++--------------
src/backend/access/hash/hashutil.c | 44 +++++++++++++++++++++++---------------
src/include/access/hash.h | 5 +++--
3 files changed, 48 insertions(+), 35 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2016-06-24 22:41:58 pgsql: Fix handling of multixacts predating pg_upgrade
Previous Message Robert Haas 2016-06-24 19:14:41 pgsql: postgres_fdw: Fix incorrect NULL handling in join pushdown.