Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fO1dk-0005lV-AN for pgsql-hackers@arkaria.postgresql.org; Wed, 30 May 2018 13:59:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fO1di-0001Iu-BD for pgsql-hackers@arkaria.postgresql.org; Wed, 30 May 2018 13:59:46 +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.89) (envelope-from ) id 1fO1di-0001Ig-0e for pgsql-hackers@lists.postgresql.org; Wed, 30 May 2018 13:59:46 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fO1de-0005M0-KW for pgsql-hackers@postgresql.org; Wed, 30 May 2018 13:59:44 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 751FF41183; Wed, 30 May 2018 15:59:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id AXHi31ucD3oZ; Wed, 30 May 2018 15:59:39 +0200 (CEST) From: Antonin Houska To: Andres Freund cc: pgsql-hackers@lists.postgresql.org, Alvaro Herrera , pgsql-hackers@postgresql.org Subject: Re: Incorrect visibility test function assigned to snapshot In-reply-to: References: <20180530132854.tkv37qiamepu3slh@alvherre.pgsql> <28218.1527687932@localhost> Comments: In-reply-to Andres Freund message dated "Wed, 30 May 2018 09:49:44 -0400." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 30 May 2018 16:00:44 +0200 Message-ID: <28524.1527688844@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund wrote: > On May 30, 2018 9:45:32 AM EDT, Antonin Houska wrote: > >Alvaro Herrera wrote: > > > >> On 2018-May-30, Antonin Houska wrote: > >>=20 > >> > In the header comment, SnapBuildInitialSnapshot() claims to set > >> > snapshot->satisfies to the HeapTupleSatisfiesMVCC test function, > >and indeed it > >> > converts the "xid" array to match its semantics (i.e. the xid items > >eventually > >> > represent running transactions as opposed to the committed ones). > >However the > >> > test function remains HeapTupleSatisfiesHistoricMVCC as set by > >> > SnapBuildBuildSnapshot(). > >>=20 > >> Interesting. While this sounds like an oversight that should have > >> horrible consequences, it's seems not to because the current callers > >> don't seem to care about the ->satisfies function. Are you able to > >come > >> up with some scenario in which it causes an actual problem? > > > >Right, the current callers in the core do not seem to use that > >function. I hit > >the issue when doing and testing some changes in an extension > >(pg_squeeze). >=20 > What is that extension doing with that snapshot? It fetches data from a table in order to insert them into a new table, to eliminate bloat. Something like pg_repack, but it uses logical decoding instead of triggers to capture concurrent data changes. --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com