为什么我在 GAE 中遇到此异常
我刚刚测试了我的应用程序并将其重新部署到测试实例,它工作正常,然后我更改了应用程序 ID 并重新部署到我的生产实例,但我遇到了索引问题。将来我该如何避免这种情况?我先去尝试了一下,效果很好!
Uncaught exception from servlet
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.. <datastore-index kind="Article" ancestor="false" source="manual">
<property name="tags" direction="asc"/>
<property name="created" direction="asc"/>
</datastore-index>
at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:40)
at com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:67)
管理控制台说它正在“构建”索引。已经说了20分钟了!多久时间!?
I just tested and redeployed my application to a test instance, and it worked fine, then i changed the app id and redeployed to my production instance, and I get an indexing problem. How do I avoid this in the future? I went to the effort to test it first and it worked fine!
Uncaught exception from servlet
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.. <datastore-index kind="Article" ancestor="false" source="manual">
<property name="tags" direction="asc"/>
<property name="created" direction="asc"/>
</datastore-index>
at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:40)
at com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:67)
The admin console says that it is "Building" the index. It has said that for 20 minutes now! How long does it take!?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当您创建新查询并在本地计算机上首次使用它们时,它们总是第一次工作。当您第一次在 Google 应用引擎上运行这些新查询时,它们将返回此异常,因为 Google 应用引擎服务器需要一些时间来生成“索引”以允许您的查询正常工作。
我建议当您创建新查询时,让它们在生产环境中运行一次以构建“索引”,这样当您的用户点击它们时,它们就会第一次工作。
其次,在需要查询之前手动预先定义查询并将其上传到服务器,这意味着当您真正需要它们时,它们可能已经构建在服务器上。
When you create new queries, and use them for the first time on your local machine, they always work first time. When you run these new queries for the first time on google app engine, they will return this exception because the google app engine servers take some time to generate an "index" to allow your query to work properly.
I would recommend when you create new queries, to give them a once off run in the production environment to get the "index" built, so that when your users hit them, they work first time.
Secondly,manually pre defining your queries before you need them and uploading them to the server, means that when you really need them they may be built on the server already.
我解决这个问题的方法是为我的应用程序维护多个版本。
通常是这样的:
当我准备好部署新版本时,我会将其上传到版本 2版本 2 设置为默认值。这样客户就不会遇到任何停机或错误。
因此,本质上您可以在发布新版本时在版本 1 和版本 2 之间进行交换。
我建议您在上传到部署的“应用程序”之前,在不同的测试“应用程序”中进行预测试。
The way I work around this problem is to maintain a number of versions for my app.
Typically something like this:
When I have a new release ready for deployment, I upload it to version 2 in this instance. Once the indexes have been built I make version 2 the default. This way customers never experience any downtime or errors.
So in essence you could swap between version 1 and 2 when releasing a new version.
I would suggest that you do also pre-test within a different testing "Application" prior to uploading to your deployed "Application".
发生这种情况是因为应用程序引擎数据存储索引未初始化,即 corydoras 的答案是正确的。我正在添加针对 java 的修复 [我认为 python 和 index.yaml 有类似的修复]。
您可以使用 https://appengine.google.com/ 上的 Google 帐户查看正在为您提供哪些索引。单击左侧的应用程序链接,然后在左侧菜单中选择数据下的数据存储索引
当对数据存储进行新查询时,可能需要数小时才能更新数据索引。
首先,您应该知道,每次存储新的“种类”实体时,本地环境中的调试都会创建一个名为 datastore-indexes-auto-xml 的文件。
在本地环境中,它可以立即用于查询,但更新 datastore-indexes-auto-xml 存在延迟。
将应用程序部署到 appengine 时,会提交自动生成的 datastore-indexes-auto-xml,并且数据索引的更新速度要快得多 [刷新页面即可查看结果]。
因此,
This happens because the app-engine Data Store Indexes are not initialized i.e. corydoras's answer is correct. I am adding my fix for java [I presume python and the index.yaml have a similar fix].
You can see which indexes are serving on your using your Google account on https://appengine.google.com/ . click the app link on the left and on the left menu choose Datastore Indexes under data
When one makes a new query to the datastore it can take hours for the data indexes to be updated.
First you should know that debugging in the local environment creates a file called datastore-indexes-auto-xml every time a new "Kind" of entity is stored.
In the local environment it can be used instantly for a query but there is a delay in updating the datastore-indexes-auto-xml.
When deploying an application to the appengine the auto generated datastore-indexes-auto-xml is submitted and the data indexes are updated much faster [to see the results refresh the page].
So
检查您的 index.yaml 文件并确保在那里指定了正确的索引等。
Check your index.yaml file and make sure the proper indices are specified there, etc.