BadValueError:重置索引并清除memcache

时间:2016-05-06 21:10:42

标签: google-app-engine memcached google-app-engine-python database-indexes

我正在使用python中的Google App Engine应用程序。我试图将我正在运行的查询之一切换为仅查询一个属性而不是2,这导致每当我们尝试运行该查询时都会出现索引错误。

这是&#34的内容;没有找到与指定参数匹配的索引",但我现在没有任何屏幕截图。为了尝试纠正这种情况,我们运行了appcfg.py vacuum_indices并删除了与原始搜索相关的所有索引。然后我们上传了一个新的index.yaml,指定了新索引。虽然我们能够看到新的索引确实是在管理面板上创建的,而旧的索引已经不见了,但我们仍然遇到了同样的错误。

我们真的不确定为什么会这样,并且无法在线查找这些问题的文档。我们的下一个想法是,memcache中的某个先前状态导致查询尝试使用它的旧索引。所以我们刷新了memcache,现在我们收到了这个错误:

File  "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
  rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
  rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
  return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
  return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
  return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
  return method(*args, **kwargs)
File "/base/data/home/apps/s~dev-erpetcloud2/dev1.392600188150722624/routes/users.py", line 172, in post
  res_dict = cp_user.to_dict()
File "/base/data/home/apps/s~dev-erpetcloud2/dev1.392600188150722624/routes/models/../models/cp_models.py", line 248, in to_dict
  animal_dict = animal.to_dict()
File "/base/data/home/apps/s~dev-erpetcloud2/dev1.392600188150722624/routes/models/../models/cp_models.py", line 574, in to_dict
  protocol, params = self.get_protocol_and_params()
File "/base/data/home/apps/s~dev-erpetcloud2/dev1.392600188150722624/routes/models/../models/cp_models.py", line 395, in get_protocol_and_params
  record = self.protocol_state_key.get()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/key.py", line 572, in get
  return self.get_async(**ctx_options).get_result()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 342, in get_result
  self.check_success()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 389, in _help_tasklet_along
  value = gen.send(val)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/context.py", line 765, in get
  pbs = entity._to_pb(set_key=False).SerializePartialToString()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 3158, in _to_pb
  self._check_initialized()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 3014, in _check_initialized
'Entity has uninitialized properties: %s' % ', '.join(baddies))
BadValueError: Entity has uninitialized properties: title

浏览数据存储区时,此跟踪引用的实体肯定有一个标题'属性。

我已经查看了很多因删除索引和刷新内存缓存而导致的错误,并且没有任何有用的内容。

如果有人能够让我对这里可能发生的事情以及这些系统如何运作(我的心理模型可能已关闭)有所了解,或者指出我正确的方向,那将是非常棒的。谢谢!

1 个答案:

答案 0 :(得分:1)

此错误表示该属性标题为'已被指定为必需属性,但您尝试将实体写入数据存储区而不初始化此属性。仅在put()时发生此错误。您是否有机会对实体定义或将这些实体写入数据存储区的代码的一部分进行任何更改?

编辑:尝试读取没有为“必需”指定值的实体时,也会发生错误。属性。