3

I am trying to understand ACID transactions, and I didn't get one thing about Durability.

As far as I get durability ensures that all completed transactions are saved, even if some sort of technology failure occurs. What does it mean to be saved even if some sort of technology failure occurs. For example, if my server is crushed during Transaction, before it saves data in database, how durability ensures that when server starts again it will saves data correctly?

Nika Kurashvili
  • 6,006
  • 8
  • 57
  • 123
  • 1
    These are two separate questions, either one of which is big enough to justify a whole answer. Therefore you should **ask them as two separate questions**. The StackOverflow model is one question per thread: please respect it. – APC Sep 06 '18 at 09:34
  • 1
    "crushed during Transaction" != "completed transactions", not sure if that is what you are wondering about, and if you understand how it works for completed transactions. – Solarflare Sep 06 '18 at 09:40

1 Answers1

4

In practice, transactions are either committed or rolled back in their entirety if when a technology failure occurs.

Failures involving unpredicted halts of servers (due to catastrophic destruction, for example) often result in the transaction being rolled back (the data left in the state before the transaction began, not in some intermediate state).

Rolled-back transactions must be repeated. That's up to the application program using the database. So, ACID puts a certain amount of burden on the application to know when transactions complete, or don't.

This is very complex subject in practice. Thousands upon thousands of programmer years have been spent making transaction processing as robust as it can be.

O. Jones
  • 103,626
  • 17
  • 118
  • 172
  • Does rolling back the transaction involve any changes to persistent storage? If the transaction was not commited before the crash took place, and thus no permanent changes to the database were made, why would we need to perform a roll-back after the system is restarted? – Mehdi Charife May 08 '23 at 14:49