0
votes

We are using 3PC (three-phase commitment) for a distributed transaction. There are 4 nodes, A, B, C, D, where A is the coordinator.

  1. A received OK from all others and sent the prepare-to-commit message to them.
  2. While C and D received this message and moved to prepared state, B crashes and doesn't received this message (thus remaining in the wait state).
  3. A timeouts on B and sends abort to all others, but only D receives the abort message, while C crashes before receiving the abort message.

Now the question is: What will C do after recovery? According to http://courses.cs.vt.edu/~cs5204/fall00/distributedDBMS/sreenu/3pc.html, C will commit upon recovery following the failure transition instead of aborting as D does. Won't that result in an inconsistent state? Or C has some mechanism to detect that the transaction in an aborted state?

1

1 Answers

0
votes

I think there's a wrong assumption in your question about the behaviour of the B node? If B crashes before it moves to prepared state then it resides in waiting for state after the restart and will be aborted.

I expect that C node will be aborted as it will be commanded by the coordinator to do so. I think this will be similar to 2PC. It's up to coordinator to periodically check if the lost nodes are available again. When C is restarted the coordinator can see it and push the node to be rolled-back as abort message will be resent.