英文:
Are queries on the "__key__" property strongly consistent with GAE datastore?
问题
我知道GAE数据存储上的查询通常是最终一致的。然而,我不明白为什么在__key__
上的查询不应该是强一致性的,因为我认为数据存储的Get函数使用的就是这个键。
有人可以确认通过__key__
进行查询是强一致性的吗?
英文:
I know generally queries on the GAE datastore are eventually consistent. However I don't see why queries on __key__
should not be strongly consistent as I presume this is what the datastore Get function uses.
Can anyone confirm querying by __key__
is strongly consistent?
答案1
得分: 0
一个查询只有在祖先查询上才是一致的。否则,即使索引包含键条目,也不是一致的。
这是因为写操作分为两个阶段,一个用于写入数据,另一个用于更新索引。按键获取永远不使用索引,所以它总是正确的。
我假设你正在生成半顺序键,否则带有键的查询将没有用处。但要注意,AppEngine现在建议扩展键范围,以便在Bigtable中更好地分布。
英文:
A query will be consistent only on ancestor queries. Otherwise is not consistent even if the index contains key entries.
This is because writes are applied in two phases, one to write your data and other to update indexes. Get by key neves uses an index so its always correct.
I assume that you are generating semi-secuential keys otherwise a query with key wouldnt be useful. Beware however that appengine now recommends to spread your keys so they cover a large space and is thus better distributed in bigtable.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论