Terminology – Term for Non-Transaction Save Actions

terminology

If you only look at the database everything is fine. You have transactions and if somethings goes wrong everything gets rolled back. That's nice – I like this.

BUT: I want to send mails. Now I am in trouble because I can't rollback.

example:

  1. transaction starts
  2. Mail gets send
  3. Other stuff gets done (inside DB)
  4. Something goes wrong.
  5. Rollback.

How to solve this is a different question, not this.

This question how to call this in general. In this example is about sending mails. But the same problem as soon as you do modify something in systems which are outside the transaction boundary.

Is there a name for this problem?

Roughly the same problem arises if you want to import files from a directory. If you delete the file inside the transaction, then the transaction might fail and the file was deleted but never imported. Or you delete the file after the transaction. Then the delete of the file might fail and the file gets imported a second time.

I don't want to reinvent a solution for this. That's why I need the matching term for this problem. Then I can read some papers and learn what's "state of the art" in the year 2018.

Best Answer

You are describing a distributed transaction. Note that the term "transaction" has a more general meaning than simply "database transaction".

In a distributed transaction different members may have different ACID properties (e.g. email is not necessarliy guaranteed to be delivered), different approaches to achieving those properties, and different failure scenarios.

To ensure consistency of a distributed transaction an external entity called transaction coordinator (or manager) is typically employed to control commitment of each member (can also be called resource or resource manager). One common method is two-phase commit (2PC).

If you search for "consistency in distributed systems" on the internets you'll find a great wealth of materials on the topic.