As the complexity of the computing system increases, so does the probability of failure. Well-designed distributed applications are not only scalable but can also recover automatically from failure. Most distributed systems use the concept of a transaction to implement automatic recovery.
Transactions allow a complex set of actions to appear as a single unit of work.
The operation being performed is legal. A transaction forms a binding contract between a client application and the code running on the server. Once the server code has signaled a client that a transaction has succeeded, it has effectively guaranteed the client that the work has been committed to durable storage. Likewise, if the server code signals the client that the transaction has been aborted, the client code is promised that as far as the data is concerned, everything is as though the operation were never attempted in the first place. Transactions greatly simplify the code that you have to write to recover from error conditions.