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 1fmyQr-0006gb-F2 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Aug 2018 09:37:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fmyQm-0001p6-G4 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Aug 2018 09:37:32 +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 1fmyQm-0001oz-13 for pgsql-hackers@lists.postgresql.org; Tue, 07 Aug 2018 09:37:32 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fmyQd-0000Fo-1g for pgsql-hackers@postgresql.org; Tue, 07 Aug 2018 09:37:30 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id C557D21C1EEE; Tue, 7 Aug 2018 12:37:19 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from ars-thinkpad (gw.postgrespro.ru [93.174.131.141]) (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 EE0F921C1EA8; Tue, 7 Aug 2018 12:37:18 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1533634639; bh=uROjucZIWptCafSOu8eUq5pd+tDC6m91fCNEuMSf/Ww=; h=References:From:To:Cc:Subject:In-reply-to:Date; b=C6DpNmIkLhVLsK2AZ9q95rrBuROI0oupgaXe5m0WzlY381wUvYSx4BJBkNSpMNWbz 8c1u2j9cXnejlaDZSSwkhyxR+WM+VHUFCmQZn0H3xuCa7qwEx71XWYquJjV+zu/FoV QkE+aojNo9xZ94A0KKGyFDXbvn6V+iFdqXUDYLS0= References: <87ab8e6e-ae35-154d-e3b5-3d8c83ea1eff@2ndquadrant.com> <20180801200123.rk6n5katv67bdvd4@alap3.anarazel.de> <877el38j56.fsf@ars-thinkpad> <20180807022739.3jg4eflrq72ypmxs@alap3.anarazel.de> User-agent: mu4e 1.1.0; emacs 26.0.50 From: Arseny Sher To: Andres Freund Cc: Nikhil Sontakke , Petr Jelinek , Robert Haas , Tomas Vondra , David Steele , Andrew Dunstan , Simon Riggs , Craig Ringer , Peter Eisentraut , Sokolov Yura , Stas Kelvich , Dmitry Dolgov <9erthalion6@gmail.com>, Tom Lane , Masahiko Sawada , PostgreSQL Hackers Subject: Re: [HACKERS] logical decoding of two-phase transactions In-reply-to: <20180807022739.3jg4eflrq72ypmxs@alap3.anarazel.de> Date: Tue, 07 Aug 2018 12:37:14 +0300 Message-ID: <87a7py4iwl.fsf@ars-thinkpad> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: >> - On decoding of aborted xacts. The idea to throw an error once we >> detect the abort is appealing, however I think you will have problems >> with subxacts in the current implementation. What if subxact issues >> DDL and then aborted, but main transaction successfully committed? > > I don't see a fundamental issue here. I've not reviewed the current > patchset meaningfully, however. Do you see a fundamental issue here? Hmm, yes, this is not an issue for this patch because after reading PREPARE record we know all aborted subxacts and won't try to decode their changes. However, this will be raised once we decide to decode in-progress transactions. Checking for all subxids is expensive; moreover, WAL doesn't provide all of them until commit... it might be easier to prevent vacuuming of aborted stuff while decoding needs it. Matter for another patch, anyway. >> - Currently we will call abort_prepared cb even if we failed to actually >> prepare xact due to concurrent abort. I think it is confusing for >> users. We should either handle this by remembering not to invoke >> abort_prepared in these cases or at least document this behaviour, >> leaving this problem to the receiver side. > > What precisely do you mean by "concurrent abort"? With current patch, the following is possible: * We start decoding of some prepared xact; * Xact aborts (ABORT PREPARED) for any reason; * Decoding processs notices this on catalog scan and calls abort() callback; * Later decoding process reads abort record and calls abort_prepared callback. -- Arseny Sher Postgres Professional: http://www.postgrespro.com The Russian Postgres Company