Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxAnW-0002Y9-1a for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Sep 2017 11:46:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dxAnU-00081S-9d for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Sep 2017 11:46:36 +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_2) (envelope-from ) id 1dxAnQ-0007z9-WC for pgsql-hackers@postgresql.org; Wed, 27 Sep 2017 11:46:33 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxAnM-0008LP-EW for pgsql-hackers@postgresql.org; Wed, 27 Sep 2017 11:46:32 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 8E8A921C1E47; Wed, 27 Sep 2017 14:46:25 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from [192.168.27.93] (unknown [192.168.27.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 025C021C1E45; Wed, 27 Sep 2017 14:46:24 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1506512785; bh=6fiymLRL6TSO65eKvLEsUeNmfOsFkBNBtga7yeKORik=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=NBcDSNaTkfVUifITXk78JK54BslWfYaqAZ6e63TJhTl+GQbBz0JxBJOE0WvydJYG3 fZ6syRnAZ6PcwD/PA+1jwoUiAWEzl1G5BE1rfu0V0Eyr2vtnWVAtWxxgzV6z9tln48 Q3KynLxBukxT7dUjnCqBFisb1rIwa+Cc3xtRQDgw= Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: logical decoding of two-phase transactions From: Stas Kelvich In-Reply-To: Date: Wed, 27 Sep 2017 14:46:23 +0300 Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Tom Lane , Masahiko Sawada , Simon Riggs , Craig Ringer , Petr Jelinek , PostgreSQL Hackers , Robert Haas Content-Transfer-Encoding: quoted-printable Message-Id: References: <20170328012546.473psm6546bgsi2c@alap3.anarazel.de> <20170328143840.b7qdvqh3uh74f2oa@alap3.anarazel.de> <20170328150823.u4he7rbd72mzeydl@alap3.anarazel.de> <9CD693AF-51BE-4A19-9D26-16031CDAD9C9@postgrespro.ru> <20170404173133.olo7keeh3dzhriay@alap3.anarazel.de> <19307.1494706954@sss.pgh.pa.us> To: Nikhil Sontakke , Andres Freund X-Mailer: Apple Mail (2.3273) 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 > On 7 Sep 2017, at 18:58, Nikhil Sontakke wrote: >=20 > Hi, >=20 > FYI all, wanted to mention that I am working on an updated version of > the latest patch that I plan to submit to a later CF. >=20 Cool! So what kind of architecture do you have in mind? Same way as is it was imp= lemented before? As far as I remember there were two main issues: * Decodong of aborted prepared transaction. If such transaction modified catalog then we can=E2=80=99t read reliable in= fo with our historic snapshot, since clog already have aborted bit for our tx it will brake visibility log= ic. There are some way to deal with that =E2=80=94 by doing catalog seq scan two times and counting n= umber of tuples (details upthread) or by hijacking clog values in historic visibility function. But = ISTM it is better not solve this issue at all =3D) In most cases intended usage of decoding of 2PC transacti= on is to do some form of distributed commit, so naturally decoding will happens only with in-prog= ress transactions and we commit/abort will happen only after it is decoded, sent and response is = received. So we can just have atomic flag that prevents commit/abort of tx currently being deco= ded. And we can filter interesting prepared transactions based on GID, to prevent holding this loc= k for ordinary 2pc. * Possible deadlocks that Andres was talking about. I spend some time trying to find that, but didn=E2=80=99t find any. If lock= ing pg_class in prepared tx is the only example then (imho) it is better to just forbid to prepare such transaction= s. Otherwise if some realistic examples that can block decoding are actually exist, then we probably need = to reconsider the way tx being decoded. Anyway this part probably need Andres blessing. Stas Kelvich Postgres Professional: http://www.postgrespro.com The Russian Postgres 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