From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
Cc: | Vinayak Pokale <vinpokale(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru> |
Subject: | Re: Transactions involving multiple postgres foreign servers |
Date: | 2016-10-13 11:27:13 |
Message-ID: | fcdc97b8-b42c-18cb-96d3-8420b3523c6b@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2016/10/13 19:37, Ashutosh Bapat wrote:
>> In case we can not reach a foreign server during post-commit phase,
>> basically the transaction and following transaction should stop until
>> the crashed server revived.
>
> I have repeatedly given reasons why this is not correct. You and Amit
> seem to repeat this statement again and again in turns without giving
> any concrete reasons about why this is so.
As mentioned in description of the "Commit" or "Completion" phase in the
Wikipedia article [1]:
* Success
If the coordinator received an agreement message from all cohorts during
the commit-request phase:
1. The coordinator sends a commit message to all the cohorts.
2. Each cohort completes the operation, and releases all the locks and
resources held during the transaction.
3. Each cohort sends an acknowledgment to the coordinator.
4. The coordinator completes the transaction when all acknowledgments
have been received.
* Failure
If any cohort votes No during the commit-request phase (or the
coordinator's timeout expires):
1. The coordinator sends a rollback message to all the cohorts.
2. Each cohort undoes the transaction using the undo log, and releases
the resources and locks held during the transaction.
3. Each cohort sends an acknowledgement to the coordinator.
4. The coordinator undoes the transaction when all acknowledgements have
been received.
In point 4 of both commit and abort cases above, it's been said, "when
*all* acknowledgements have been received."
However, when I briefly read the description in "Transaction Management in
the R* Distributed Database Management System (C. Mohan et al)" [2], it
seems that what Ashutosh is saying might be a correct way to proceed after
all:
"""
2. THE TWO-PHASE COMMIT PROTOCOL
...
After the coordinator receives the votes from all its subordinates, it
initiates the second phase of the protocol. If all the votes were YES
VOTES, then the coordinator moves to the committing state by force-writing
a commit record and sending COMMIT messages to all the subordinates. The
completion of the force-write takes the transaction to its commit point.
Once this point is passed the user can be told that the transaction has
been committed.
...
"""
Sorry about the noise.
Thanks,
Amit
[1] https://en.wikipedia.org/wiki/Two-phase_commit_protocol#Commit_phase
[2] http://www.cs.cmu.edu/~natassa/courses/15-823/F02/papers/p378-mohan.pdf
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2016-10-13 12:32:31 | Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1 |
Previous Message | Ashutosh Bapat | 2016-10-13 10:37:57 | Re: Transactions involving multiple postgres foreign servers |