“__key__”属性的查询在GAE数据存储中是否具有强一致性?

huangapple go评论109阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2014年3月26日 06:16:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/22647454.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定