Why is C in CAP theorem not same as C in ACID?

岁酱吖の 提交于 2019-12-23 09:09:11

问题


My question is pretty simple, was looking for a simpler answer, Why is C in CAP theorem not same as C in ACID?

Read this HN thread.

Update

A Hitchhiker's Guide to NOSQL v1.0, slide 71 says: C in CAP = A+C (Atomic Consistency)


回答1:


Both C's stand for consistency, but the notion of consistency in CAP means that "all nodes see the same data at the same time" and the notion of consistency in ACID means that "any transaction the database performs will take it from one consistent state to another". (From Wikipedia.)




回答2:


You cannot hardly have meaningful consistency without atomicity. This is why the CAP theorem defines the C in the way that it does.

Imagine this simple scenario:

There is a database with two accounts. There is no money coming in our out of the database. Just the money on the two accounts. In the database, money is moved between one account to another.

Without atomicity, the user could read the data when money has been deducted from one account while it has not yet been written to the other. In this case, the grand total of the two accounts would vary from read to read, something that should be impossible as "new" money is not leaving or entering the database.

To talk about consistency in any other way is like thinking about a Java boolean as being "nearly" true while the rest of the world reads it as false.



来源:https://stackoverflow.com/questions/4813282/why-is-c-in-cap-theorem-not-same-as-c-in-acid

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!