Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 servers participating in 2PC scenario:

* Srv1: votes OK
* Srv2: votes OK
* Coordinator runs "commit"
* Srv1: commits
* Srv2: does not accept "commit" command because of network failure

From this moment my distributed DB is not consistence anymore.

How it should be solved?

share|improve this question

migrated from Oct 31 '12 at 19:12

This question came from our site for professional and enthusiast programmers.

How to move it there? – user996142 Oct 31 '12 at 14:34
We must have 4 more votes to move it, or you can delete your question and re-ask there. – Kermit Oct 31 '12 at 14:36
Why does this belong on This is an algorithmic question as I understand it. – usr Oct 31 '12 at 14:59

Server 2 is obliged by its duties under the 2PC to contact the coordinator for advice on the state of the transaction. Until it gets a Commit or Rollback from the coordinator, it must hold the transaction in the 'Ready to Commit' state, locks and all — even if it is restarted.

This could go on indefinitely, of course, so in practice there are 'Presumed Fail' or 'Presumed Succeed' heuristics that can be applied, but it is not something to undertake lightly. If you get into a heuristic operation, then you probably do have an inconsistent set of databases — which is just one reason not to go 'heuristic' in a hurry. Of course, if the Coordinator or the network are out of commission for any extended period of time, you probably have other problems than just database consistency.

You can find out a lot from reading Concurrency Control and Recovery in Database Systems by Philip A. Bernstein, Vassos Hadzilacos, Nathan Goodman (available for download). That is tough going, though. You could look in Date (Database Fundamentals, 8th Edn), but it is covered very briefly there, or Recovery Mechanisms in Database Systems by Kumar and Hsu, which has a substantial discussion of 2PC in chapter 13.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.