调用 put() 后我得到 id 1952002
当我进入数据存储查看器时,该实体不存在。当我查询该实体时,没有结果
public String addFeedback(String feedbackText) {
Text TextFeedbackText = new Text(feedbackText);
Entity entity = new Entity("FeedBack");
entity.setProperty("feedbackText", TextFeedbackText);
return "" + datastore.put(entity).getId(); // returns 1952002
}
这个函数以前工作得很好。我已经有一段时间没有使用它了,但现在它停止工作了。 我检查了日志,一切正常
2014-03-18 19:40:00.856 /feedback/add/ 200 258ms 0kb module=default version=2 151.228.xxx.xxx - - [18/Mar/2014:12:40:00 -0700] "POST /feedback/add/ HTTP/1.1" 200 33 - - "xxxxx.appspot.com" ms=258 cpu_ms=42 cpm_usd=0.000004 app_engine_release=1.9.0 instance=00cxxxxxxxxxxxxxxxxx19ec5
有人知道可能是什么问题吗?
最佳答案
“它开始自行工作”
98% 的情况下,人们在存储实体时会遇到这种情况,但在执行查询时却看不到它,这是由于“最终一致性”所致。
有关完整说明和前进方向,请参阅 https://developers.google.com/appengine/docs/python/datastore/structuring_for_strong_consistency
关于java - 将实体保存到数据存储后找不到实体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22489605/