1

The word consistency is The place overloaded

  1. • Replica consistency and the issue of eventual consistency that prove in asynchronously replicated systems.
  2. • Consistent hashing is an approach to partitioning that some systems use for rebalancing.
  3. • In the CAP theorem (see Chapter 9), the word consistency is used to mean linearizability.
  4. • In the context of ACID, consistency refers to an application-specific notion of the database being In a “good state.”

It’s unfortunate that the same word is used with at least four different meanings.

2 Why is C not ACID

The idea of consistency is that you have certain statements about data (invariants) that must always be true — for example, in an accounting system, the credits and debits of all accounts must always be in balance. If the transaction starts with a database that is valid according to these invariants, and any operation that takes place during the transaction retains validity, you can be sure invariants are always satisfied. The idea of ACID consistency is that you have certain statements about your data (invariants) that must always be True – For example, in an accounting system, credits and debits across all accounts must always be balanced. If a transaction starts with a database that is valid according to these invariants, and any writes during the transaction preserve the validity, then you can be sure that the invariants are always satisfied.

// However, this concept of consistency depends on the concept of immutability of the application, and it is the responsibility of the application to define its transactions correctly to maintain consistency. This is not guaranteed by the database: if you write data that violates invariants, there is nothing the database can do to stop you. The database can check for certain kinds of invariants, such as using foreign key constraints or uniqueness constraints. Typically, however, the application defines what data is valid or invalid – the database only stores that data. However, this idea of consistency depends on the application’s notion of invariants, And it’s the application’s responsibility to define its transactions correctly so that they preserve consistency. This is not something that the database can guarantee: if you write bad data that violates your invariants, The database can’t stop you. (Some specific kinds of invariants can be checked by the database, for example using foreign key constraints or uniqueness constraints. However, in general, The application defines what data is valid or invalid — the database only stores it.

Atomicity, isolation, and persistence are attributes of the database, while consistency (in the ACID sense) are attributes of the application. The application may rely on the atomicity and isolation properties of the database for consistency, but not just the database. Therefore, the letter C is not really ACID. Atomicity, isolation, and durability are properties of the database, 4. Consistency (in the ACID sense) is a property of the application. The application may rely on the database’s Atomicity and isolation properties in order to achieve consistency, but it’s not up to the database alone. Thus, The letter C doesn’t really belong in ACID.

3 summary

  1. Consistency (in the ACID sense) is an application property;
  2. Atomicity, isolation, and persistence are attributes of the database, while consistency (in the ACID sense) is an application property.
  3. Refer to Designing data-intensive Applications