Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Here is a very short explanation to refresh your thoughts: 2PC consists of distributed databases running the same transaction by splitting it up into two phases. Contradictionary to the normal transaction, this one doesn't work like the following:


BEGIN TRANSACTION ...

DO Something()....

COMMIT


But rather, it has an additional step in the middle:


BEGIN TRANSACTION...

DO Something()...

PREPARE TO COMMIT

IF (all_commited()== true)
COMMIT


(If you forgive my pidgin Java/SQL)

If you always wanted to know what a two phase commit (2PC) was, but never dared to ask, read the article by Armand Wilson Distributed Transactions and Two-Phase Commit, which explains this perfectly.

But Armand is too polite about the reasons why a 2PC is just unusable in a business environment.

Yes, my statement is this:


Two Phase Commit is unusable for business software.



There are two reasons why I say "unusable":




1. A 2PC transaction depends on the assumption that the second phase of the commit will be successful. This is usually the case. But because you have to take care of unexpected situations as well, the literature of 2PC blows the whistle: once you get this deep into 2PC, you will find dirty descriptions of the method on how to solve such situations. The descriptions usually speak about "heuristic" methods to solve such a situation. I'd like you to take a moment and read the definition of "heuristic methods" from dictionary.com :

</p>

"Relating to or using a problem-solving technique in which the most appropriate solution of several found by alternative methods is selected at successive stages of a program for use in the next step of the program."



More enlightening is the definition from the Free online dictionary of computing

Well, I might answer: I like clear statements.

7 Comments