Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLGpf-0004l0-W5 for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jul 2015 20:23:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZLGpf-0005XM-0Z for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jul 2015 20:23:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZLGoM-00043P-2F for pgsql-hackers@postgresql.org; Fri, 31 Jul 2015 20:21:46 +0000 Received: from nm4-vm3.bullet.mail.gq1.yahoo.com ([98.136.218.162]) by magus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZLGoG-00035I-Mm for pgsql-hackers@postgresql.org; Fri, 31 Jul 2015 20:21:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1438374096; bh=ifbl9ZEzQLSKRcDnNutLPblxDbdAm09/jDbbw8WHYbw=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=jiboyiGpxCn8TPUJJY1VfTbEYNjzOWG/nUg9hgwujL/UdRfNYKhShYFejvTusD0PLToZjzFdGaOl5+M3RGIbpGmHQhK2g+yz+JKvB9FTo6HBW8faNcKgffI1s4fyJ+9Qhal425258kX7vbfR1BUgnHq0CkuD0TSZe0e5R5IYweh+tNyM9PMYWgSeZuJ+On9XZH1kED3GRCzg0JtvE3I4L0Od4/bcIFBxJbTenX1MWAZ04H4Ovkm+ez9ZELTj4mgqhG6HJe8CxSPPq2NAtc14sGZ5aEX5RtbaeTO8g/BI63lyr0xOWQx/wDnjvp27726bKHeeBOFgdjMJTgmBjHAyZg== Received: from [98.137.12.190] by nm4.bullet.mail.gq1.yahoo.com with NNFMP; 31 Jul 2015 20:21:36 -0000 Received: from [98.137.12.199] by tm11.bullet.mail.gq1.yahoo.com with NNFMP; 31 Jul 2015 20:21:36 -0000 Received: from [127.0.0.1] by omp1007.mail.gq1.yahoo.com with NNFMP; 31 Jul 2015 20:21:36 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 896867.68455.bm@omp1007.mail.gq1.yahoo.com X-YMail-OSG: 0vygA6cVM1lA6hdoy1ucevIOZpUeURjf8vflY8QYN_Cvt_aIv6QHU2k9QzTDxsi QpNJEywLWCUjznlpWVk1PStcZSgLGJVJ9QgkBvp6zCip2eyYAzPE9lc18io8jW2fb8459m1rO4zX HzMn.l25re1Jp7mptqjQn4QklRZ7tvEP4n9NpYYHj1YM5aAECQvx5X6KGIpkWlOHF28H3gHoq0lB KNW0kijpbXox1wJDC9LLuFdVGQ6E6WxNUJEhitDaUYEH0befrcSTwYcAHzLCrnaN4JFNmOSJd6e3 K6XnIX0jcgYrzkmxA3zoxbSuPEB2PAJOy9r9eIOiLdRLInI.NMug7DJMa5cw0sJKrus9vPm6Bblf QMvUFeBKiNg4RhMq5m7S9q90DV1N0GjmCyPkZniEyVUMzuhrmSn4QdEv7pfY6hpl5b35yuEiUDGJ RJXBdfEc3Ch4IjSjCREdsDoz5k_xqSdJ_bKs46w1q7OkT_R88K2wOc8_qZyobuLPs.Ri6iHOA0fV Np..R6WdphfDTxAba Received: by 216.39.60.192; Fri, 31 Jul 2015 20:21:36 +0000 Date: Fri, 31 Jul 2015 20:21:15 +0000 (UTC) From: Kevin Grittner Reply-To: Kevin Grittner To: Alvaro Herrera Cc: PostgreSQL-development Message-ID: <64199124.3265995.1438374075160.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <20150731194524.GB2441@postgresql.org> References: <20150731194524.GB2441@postgresql.org> Subject: Re: brin index vacuum versus transaction snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Length: 1475 X-Pg-Spam-Score: -2.7 (--) 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 Alvaro Herrera wrote: >> 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. Please excuse my naivet=C3=A9 on the topic, but could you explain (or point me to the documented explanation) of why we don't scan using a non-MVCC snapshot and build the page range based on all non-dead tuples? I understand that the range being scanned would need to be locked, but we're OK with doing that for creation of other indexes. (There is no mention of snapshots or locks in the BRIN README....) -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers