Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLGGv-0002MP-Es for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jul 2015 19:47:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZLGGv-0001oT-1T for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jul 2015 19:47:13 +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 1ZLGFd-0000MX-Dc for pgsql-hackers@postgresql.org; Fri, 31 Jul 2015 19:45:53 +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 1ZLGFa-0000o0-6p for pgsql-hackers@postgresql.org; Fri, 31 Jul 2015 19:45:52 +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 [181.43.21.225]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id B2D0D400F4B; Fri, 31 Jul 2015 12:45:47 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 397FB3B9; Fri, 31 Jul 2015 16:45:24 -0300 (CLT) Date: Fri, 31 Jul 2015 16:45:24 -0300 From: Alvaro Herrera To: Kevin Grittner Cc: PostgreSQL-development Subject: Re: brin index vacuum versus transaction snapshots Message-ID: <20150731194524.GB2441@postgresql.org> References: <20150730200140.GV2441@postgresql.org> <784585654.3180934.1438353052254.JavaMail.yahoo@mail.yahoo.com> <20150731175700.GX2441@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150731175700.GX2441@postgresql.org> 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 > I think the real solution to this problem is to avoid use of > GetTransactionSnapshot(), and instead use GetLatestSnapshot(). As far > as I can see, that should completely close the hole. This requires > patching IndexBuildHeapRangeScan() to allow for that. Actually I think there's another problem: if a transaction starts and inserts a tuple into the page range, then goes to sleep, and then another session does the summarization of the page range, session 1 is seen as "in progress" by session 2 (so the scan does not see the new tuple), but the placeholder tuple was not modified either because it was inserted later than the snapshot. So the update is lost. I think the only way to close this hole is to have summarize_range() sleep until all open snapshots are gone after inserting the placeholder tuple and before acquiring the snapshot, similarly to how CREATE INDEX CONCURRENTLY does it. -- Á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