pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add missing index_insert_cleanup calls
Date: Fri, 19 Apr 2024 14:09:28 +0000
Message-ID: <E1rxovf-002qLy-Ry@gemulon.postgresql.org> (raw)

Add missing index_insert_cleanup calls

The optimization for inserts into BRIN indexes added by c1ec02be1d79
relies on a cache that needs to be explicitly released after calling
index_insert(). The commit however failed to invoke the cleanup in
validate_index(), which calls index_insert() indirectly through
table_index_validate_scan().

After inspecting index_insert() callers, it seems unique_key_recheck()
is missing the call too.

Fixed by adding the two missing index_insert_cleanup() calls.

The commit does two additional improvements. The aminsertcleanup()
signature is modified to have the index as the first argument, to make
it more like the other AM callbacks. And the aminsertcleanup() callback
is invoked even if the ii_AmCache is NULL, so that it can decide if the
cleanup is necessary.

Author: Alvaro Herrera, Tomas Vondra
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/202401091043.e3nrqiad6gb7@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/41d2c6f952edc4841763d05296b65f3c0edad4f2

Modified Files
--------------
doc/src/sgml/indexam.sgml          | 14 +++++++-------
src/backend/access/brin/brin.c     |  6 ++++--
src/backend/access/index/indexam.c |  5 ++---
src/backend/catalog/index.c        |  3 +++
src/backend/commands/constraint.c  |  3 +++
src/include/access/amapi.h         |  3 ++-
src/include/access/brin_internal.h |  2 +-
src/test/regress/expected/brin.out |  3 ++-
src/test/regress/sql/brin.sql      |  3 ++-
9 files changed, 26 insertions(+), 16 deletions(-)



Message-ID: <E1rxovf-002qLy-Ry@gemulon.postgresql.org>
Permalink:  ../E1rxovf-002qLy-Ry@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rxovf-002qLy-Ry@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add missing index_insert_cleanup calls
  In-Reply-To: <E1rxovf-002qLy-Ry@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