pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <kgrittn@ymail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: brin index vacuum versus transaction snapshots
Date: Fri, 31 Jul 2015 14:30:52 +0000 (UTC)
Message-ID: <784585654.3180934.1438353052254.JavaMail.yahoo@mail.yahoo.com> (raw)
In-Reply-To: <20150730200140.GV2441@postgresql.org>
References: <20150730200140.GV2441@postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> Kevin Grittner wrote:

>> If you run `make installcheck` against a cluster with
>> default_transaction_isolation = 'repeatable read' you get one
>> failure:
>
> I am tempted to say that we should just disallow to run vacuum on
> a table containing a brin index in a transaction-snapshot
> transaction.

You do realize that the VACUUM command was not run inside an
explicit transaction, right?  The only change was that in the
postgresql.conf file I set default_transaction_isolation =
'repeatable read'.  That was my first step before confirming that
nothing was broken for 'serializable'; but if it doesn't pass in
'repeatable read' it's not going to pass in serializable.  Anyway,
for those using serializable transactions to handle race conditions
so that they don't need to use explicit LOCK TABLE statements or
SELECT FOR UPDATE clauses, setting that as the default in
postgresql.conf is standard procedure.  Are you suggesting that
those users should need to run VACUUM commands bracketed with
adjustments to that GUC, like this?:

set default_transaction_isolation = 'read committed';
vacuum [...];
reset default_transaction_isolation;

What about autovacuum?

> It is possible to silence the problem by checking for vacuum
> flags, but (without testing) I think there will be a problem
> because the snapshot is acquired too early and it is possible for
> concurrent transactions to insert tuples in the table that the
> summarizing scan will not see, which will cause the index to
> become effectively corrupt.

If that's true, it sounds like vacuum of BRIN indexes might be
broken in a pretty fundamental way.  Shouldn't it be using a
snapshot that lets it see everything past the global xmin
threshold, and let the *users* of the index ignore those tuples
that are not visible to *them*?  From what you're saying here it 
sounds like the BRIN index is failing to include in its bounds any 
tuples not visible to some arbitrary snapshot?

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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



view thread (20+ messages)  latest in thread

Message-ID: <784585654.3180934.1438353052254.JavaMail.yahoo@mail.yahoo.com>
Permalink:  ../784585654.3180934.1438353052254.JavaMail.yahoo@mail.yahoo.com/
Also on:    postgresql.org/message-id/784585654.3180934.1438353052254.JavaMail.yahoo@mail.yahoo.com

 · 

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-hackers@postgresql.org
  Cc: kgrittn@ymail.com, alvherre@2ndquadrant.com
  Subject: Re: brin index vacuum versus transaction snapshots
  In-Reply-To: <784585654.3180934.1438353052254.JavaMail.yahoo@mail.yahoo.com>
  References: <20150730200140.GV2441@postgresql.org> <784585654.3180934.1438353052254.JavaMail.yahoo@mail.yahoo.com>

* 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