1

This is so weird...

First of all this query works in the datastore viewer, ie. it returns the correct row.

SELECT * FROM Level where short_id = 'Ec71eN'

But if I run this

Level.all().filter("short_id = ", 'Ec71eN').get()

it returns None, if I run this:

db.GqlQuery("SELECT * FROM Level where short_id = '%s'" % 'Ec71eN').get()

it also returns None. If I run this:

level = Level.get_by_id(189009)

it returns the correct row (189009 is the id for the correct row)

Puzzling? What can be wrong here? I have never seen anything like this before, it has worked correctly for at least a couple of weeks in production... I think I have at least two cases now where it dosent work starting today.


UPDATE: This can not be a eventually consistent problem since the row was 7 hours old when I tried the above. I had two rows with same symptoms, strangely booth generated by the same users. They where booth "fixed" after I did a manual fecth of their ids by uploading special case code like:

if short_id==CASE_1_SHORT_ID: 
     level = Level.get_by_id(CASE_1_ID)

After that the query worked as usual.

4

2 回答 2

4

你在用HRD吗?什么都没有。你知道它应该是最终一致的吗?

查询操作最终是一致的。Get-by-id 操作是完全一致的。

您描述的是正确的数据存储行为。数据存储查看器操作返回正确的结果有点奇怪,但它可能在数据存储操作上击中了单独的平板电脑。

于 2013-03-06T19:15:36.103 回答
1

鉴于它是在 7 小时前创建的,“最终一致性”通常需要几秒钟到几分钟的时间。如果最终一致性是问题,请多次运行相同的查询方法,看看是否返回相同的结果。如果它使用相同的方法连续返回相同的结果,那么它很可能不是最终的一致性问题。你也应该切换到 NDB API 来查询数据——它好 1000 倍,而且 Guido 也在研究它——所以你知道它很好。NDB 是否表现出同样的不一致?

于 2013-03-07T13:16:25.807 回答