Google AppEngine DataStore的一致性 [英] Google AppEngine DataStore constistency
问题描述
我目前对Google AppEngine的高复制数据存储的理解如下: 获取
获取和 puts 多个实体是强一致的,如果它们属于相同的祖先组并且在事务中执行,即如果我有两个实体在事务中被一个 put 修改并且同时在另一个与 get 的事务中读取,则 get 将返回两个条目的旧版本或两个条目的新版本,具体取决于 put -transaction在获取时间是否已完成或不是,但它永远不会返回一个实体的旧值和另一个实体的新值。
查询祖先过滤器可以选择强或最终一致,其中一个强烈一致的查询需要更长的时间才能完成,但会始终返回在这个祖先组的同一个事务中更新的所有实体的相同版本(旧的或新的),并且从来没有一些旧的和一些新的版本。
我有这个对吗?这实际上是在任何地方记录? (我只找到一些有关查询一致性的文档此处(第一个和第二个注释)和此处,但它没有讨论 和 puts ...)
你是对的。他们用略微不同的话来说:
https://developers.google.com/appengine/docs/java/datastore/
刚开始的时候,有5个表单功能。最后两个描述你的问题,除了它们指的是读取而不是获取。
这可能会增加你的困惑,但是当它们意味着读取或获取,它的确意味着直接获取实体 - 通过key或id。如果你使用key或id以外的属性调用python'get'函数,它实际上会发出一个查询,这个查询最终是一致的(除非它是一个祖先查询)。
My current understanding of Google AppEngine's High Replication DataStore is the following:
Gets and puts of individual entities are always strongly consistent, i.e. once a put of this entry completes, no later get will ever return a version earlier than the completed put. Or, more precisely, as soon as any one get returns the new version, no later get will ever return the old version again.
Gets and puts of multiple entities are strongly consistent, if they belong to the same ancestor group and are performed in a transaction, i.e. if I have two entities that are both being modified in a transaction by a put and "simultaneously" read in a different transaction with a get, the get will either return the old version of both entries or the new version of both entries, depending on whether the put-transaction has completed at the time of the get or not, but it will never return the old value of one entity and the new value of the other.
Queries with an ancestor filter can be chosen to be strongly or eventually consistent, where a strongly consistent query takes longer to complete, but will always return the "same" version (old or new) of all entities updated in the same transaction in this ancestor group and never some old and some new versions.
Queries that span ancestors are always eventually consistent, i.e. might return an old version of one result entity and a new version of another.
Did I get this right? Is this actually documented anywhere? (I only found some documentation about the query consistency here (between the first and second "Note") and here, but it doesn't talk about gets and puts...)
Yes, you're correct. They just word it slightly differently:
https://developers.google.com/appengine/docs/java/datastore/
Right at the beginning there are 5 point form features. The last two describe your question, except that they refer to "reads" instead of "gets".
This probably adds to your confusion, but when they mean "read" or "get", it really means fetching an entity directly - by key or id. If you call the python 'get' function with an attribute other than the key or id, it's actually issuing a query, which is eventually consistent (unless it's an ancestor query).
这篇关于Google AppEngine DataStore的一致性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!