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