Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kGNTC-0000fW-Jl for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Sep 2020 14:22:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kGNT9-0002XB-Uk for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Sep 2020 14:22:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kGNT9-0002X4-NV for pgsql-hackers@lists.postgresql.org; Thu, 10 Sep 2020 14:22:35 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kGNT2-0003xU-Sh for pgsql-hackers@postgresql.org; Thu, 10 Sep 2020 14:22:35 +0000 Received: from mail.postgrespro.ru (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 2B06121C33ED; Thu, 10 Sep 2020 17:22:27 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1599747747; bh=gZbl3JO89vCn31yN82DgqnXAZNfK+rRiAgzLUwSChdM=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=PxRa1YydKLHh7bcO9uHPnmexIigZAkiuoC+R8iWoQrGbCooTVjzfwkP/UmXUIvwm+ 0UUYi/iZJgHySdJKNQ7ZXcQVfhF85/YpnJ56TW29T0+OupPLQE7M38M44y4ccuRg+J 04Qxo+eXzBp4U9vF4MjRljE7qq/+giI6yi/MjMs0= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 10 Sep 2020 17:22:27 +0300 From: Alexey Kondratov To: Fujii Masao Cc: "Andrey V. Lepikhov" , tsunakawa.takay@fujitsu.com, movead.li@highgo.ca, 'Amit Kapila' , Masahiko Sawada , PostgreSQL-Dev Subject: Re: Global snapshots In-Reply-To: References: <07b2c899-4ed0-4c87-1327-23c750311248@postgrespro.ru> <806c3708-26ea-b94d-87b1-d48e41e93726@postgrespro.ru> <3ef7877bfed0582019eab3d462a43275@postgrespro.ru> <057004b6-68bf-98ee-7c57-91c418f6e221@oss.nttdata.com> <0e51d0298eed7588664e3c67a4fb15c9@postgrespro.ru> <53b1586317ae98ecd8c3383f2c9e7c16@postgrespro.ru> User-Agent: Roundcube Webmail/1.4.0 Message-ID: X-Sender: a.kondratov@postgrespro.ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-09-09 20:29, Fujii Masao wrote: > On 2020/09/09 2:00, Alexey Kondratov wrote: >> >> According to the Sawada-san's v25 0002 the logic is pretty much the >> same there: >> >> +2. Pre-Commit phase (1st phase of two-phase commit) >> >> +3. Commit locally >> +Once we've prepared all of them, commit the transaction locally. >> >> +4. Post-Commit Phase (2nd phase of two-phase commit) >> >> Brief look at the code confirms this scheme. IIUC, AtEOXact_FdwXact / >> FdwXactParticipantEndTransaction happens after >> ProcArrayEndTransaction() in the CommitTransaction(). Thus, I don't >> see many difference between these approach and CallXactCallbacks() >> usage regarding this point. > > IIUC the commit logic in Sawada-san's patch looks like > > 1. PreCommit_FdwXact() > PREPARE TRANSACTION command is issued > > 2. RecordTransactionCommit() > 2-1. WAL-log the commit record > 2-2. Update CLOG > 2-3. Wait for sync rep > 2-4. FdwXactWaitForResolution() > Wait until COMMIT PREPARED commands are issued to the > remote servers and completed. > > 3. ProcArrayEndTransaction() > 4. AtEOXact_FdwXact(true) > > So ISTM that the timing of when COMMIT PREPARED is issued > to the remote server is different between the patches. > Am I missing something? > No, you are right, sorry. At a first glance I thought that AtEOXact_FdwXact is responsible for COMMIT PREPARED as well, but it is only calling FdwXactParticipantEndTransaction in the abort case. Regards -- Alexey Kondratov Postgres Professional https://www.postgrespro.com Russian Postgres Company