3 Distributed Systems
3.1 Databases
3.1.1 ACID
The ACID properties—Atomicity, Consistency, Isolation, and Durability—are key database concepts. Understanding these four properties is critical for anyone working with databases. Let’s break them down.
Atomicity
Definition: All the operations of a transaction must succeed, or none will.
In simpler terms: All or nothing. If one part of a transaction fails, the entire transaction is rolled back, leaving the database unchanged. For example, imagine a bank transfer where money is deducted from one account and added to another. If either step fails, the entire transaction is rolled back, and neither account is updated.
Note that the concept of atomicity can also extend beyond databases to distributed systems. For instance, we may want to design a process that both writes to a database and publishes a message to Kafka. Yet, we want to guarantee that if one operation fails, the other operations will be reverted. In this case, we can say the process is atomic, as it will be all or nothing as well. Yet, it becomes a property of the entire system, not just the database.
Consistency
Definition: The database must transition from one valid state to another.
The definition can be divided into two parts: