Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZHyOZ-0003gd-AB for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jul 2015 18:05:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZHyOY-0003wX-Rt for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jul 2015 18:05:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZHyNE-0000zJ-Kb for pgsql-hackers@postgresql.org; Wed, 22 Jul 2015 18:04:08 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZHyNB-0004uf-8E for pgsql-hackers@postgresql.org; Wed, 22 Jul 2015 18:04:07 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [89.248.140.8]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id DA28B40091F; Wed, 22 Jul 2015 11:03:59 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id AD2FE727; Wed, 22 Jul 2015 20:03:57 +0200 (CEST) Date: Wed, 22 Jul 2015 20:03:57 +0200 From: Alvaro Herrera To: Kevin Grittner Cc: PostgreSQL-development Subject: Re: brin index vacuum versus transaction snapshots Message-ID: <20150722180357.GL5596@postgresql.org> References: <185774103.1833212.1437507758024.JavaMail.yahoo@mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <185774103.1833212.1437507758024.JavaMail.yahoo@mail.yahoo.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Kevin Grittner wrote: > If you run `make installcheck` against a cluster with > default_transaction_isolation = 'repeatable read' you get one > failure: So there's some code that's specifically intended to handle this case: /* * If using transaction-snapshot mode, it would be possible * for another transaction to insert a tuple that's not * visible to our snapshot if we have already acquired one, * when in snapshot-isolation mode; therefore, disallow this * from running in such a transaction unless a snapshot hasn't * been acquired yet. * * This code is called by VACUUM and * brin_summarize_new_values. Have the error message mention * the latter because VACUUM cannot run in a transaction and * thus cannot cause this issue. */ if (IsolationUsesXactSnapshot() && FirstSnapshotSet) ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), errmsg("brin_summarize_new_values() cannot run in a transaction that has already obtained a snapshot"))); However, this comment is full of it because a snapshot is obtained even for VACUUM. So the fact that brin_summarize_new_values() is mentioned as being in trouble is just a very minor issue: fixing that would just be a matter of passing a flag down from the caller into summarize_range() to indicate whether it's vacuum or the function. The real problem is that VACUUM should be allowed to run without error. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers