pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make materialized views participate in predicate locking
Date: Thu, 01 Dec 2022 06:43:06 +0000
Message-ID: <E1p0dHl-001Wor-CL@gemulon.postgresql.org> (raw)

Make materialized views participate in predicate locking

Matviews have been discarded from needing predicate locks since 3bf3ab8
and their introduction.  At this point, there was no concurrent flavor
of REFRESH yet, hence there was no meaning in having materialized views
look at read/write conflicts with concurrent transactions using
themselves the serializable isolation level because they could only be
refreshed with an access exclusive lock.  CONCURRENTLY, on the contrary,
allows reads and writes during a refresh as it holds a share update
exclusive lock.

Some isolation tests are added to show the effect of the change, with a
combination of one table and a matview based on it, using a mix of
REFRESH CONCURRENTLY and read/write queries.

This could arguably be considered as a bug, but as it is a subtle
behavior change potentially impacting applications no backpatch is
done.

Author: Yugo Nagata
Reviewed-by: Richard Guo, Dilip Kumar, Michael Paquier
Discussion: https://postgr.es/m/20220726164434.42d4e33911b4b4fcf751c4e7@sraoss.co.jp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/43351557d0d2b9c5e20298b5fee2849abef86aff

Modified Files
--------------
src/backend/storage/lmgr/predicate.c               |   5 +-
src/test/isolation/expected/matview-write-skew.out | 121 +++++++++++++++++++++
src/test/isolation/isolation_schedule              |   1 +
src/test/isolation/specs/matview-write-skew.spec   |  51 +++++++++
4 files changed, 175 insertions(+), 3 deletions(-)



Message-ID: <E1p0dHl-001Wor-CL@gemulon.postgresql.org>
Permalink:  ../E1p0dHl-001Wor-CL@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p0dHl-001Wor-CL@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: michael@paquier.xyz
  Subject: Re: pgsql: Make materialized views participate in predicate locking
  In-Reply-To: <E1p0dHl-001Wor-CL@gemulon.postgresql.org>
  References: <E1p0dHl-001Wor-CL@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