【ACID】C不属于ACID,一致性不属于ACID,为什么?

1 C 的含义

The word consistency is terribly overloaded:重载含义四个

  1. • Replica consistency and the issue of eventual consistency that arises 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 为什么C不属于ACID

// ACID一致性的想法是,您对数据(不变量)有某些陈述,这些陈述必须始终是真实的-例如,在会计系统中,所有账户的贷方和借方必须始终保持平衡。如果事务从根据这些不变量有效的数据库开始,并且在事务期间进行的任何操作都保留了有效性,那么您可以确保始终满足不变量。
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 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.)

// 原子性,隔离性和持久性是数据库的属性,而一致性(在ACID意义上)是应用程序的属性。该应用程序可能依赖于数据库的原子性和隔离属性来实现一致性,但并不仅仅取决于数据库。因此,字母C并不真正属于ACID。
Atomicity, isolation, and durability are properties of the database, whereas 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 小结

  1. 一致性(在ACID意义上)是应用程序的属性;
  2. 原子性,隔离性和持久性是数据库的属性,而一致性(在ACID意义上)是应用程序的属性。
  3. 参考 Designing Data-Intensive Applications
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页