为什么我在 GAE 中遇到此异常

发布于 2024-09-10 09:17:20 字数 694 浏览 6 评论 0原文

我刚刚测试了我的应用程序并将其重新部署到测试实例,它工作正常,然后我更改了应用程序 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心碎无痕… 2024-09-17 09:17:20

当您创建新查询并在本地计算机上首次使用它们时,它们总是第一次工作。当您第一次在 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.

玉环 2024-09-17 09:17:20

我解决这个问题的方法是为我的应用程序维护多个版本。
通常是这样的:

  • 版本 1:当前默认
  • 版本 2:下一个版本

当我准备好部署新版本时,我会将其上传到版本 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:

  • Version 1: Current Default
  • Version 2: Next release

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".

來不及說愛妳 2024-09-17 09:17:20

发生这种情况是因为应用程序引擎数据存储索引未初始化,即 corydoras 的答案是正确的。我正在添加针对 java 的修复 [我认为 python 和 index.yaml 有类似的修复]。

您可以使用 https://appengine.google.com/ 上的 Google 帐户查看正在为您提供哪些索引。单击左侧的应用程序链接,然后在左侧菜单中选择数据下的数据存储索引

当对数据存储进行新查询时,可能需要数小时才能更新数据索引。

首先,您应该知道,每次存储新的“种类”实体时,本地环境中的调试都会创建一个名为 datastore-indexes-auto-xml 的文件。

在本地环境中,它可以立即用于查询,但更新 datastore-indexes-auto-xml 存在延迟。

将应用程序部署到 appengine 时,会提交自动生成的 datastore-indexes-auto-xml,并且数据索引的更新速度要快得多 [刷新页面即可查看结果]。

因此,

  1. 请确保您的实体中没有非法符号,例如“&”。
  2. 打开 appengine.google.com 上的数据索引视图。
  3. 确保您尚未删除 datastore-indexes-auto-xml。 [我经常这样做]
  4. 存储每种“种类”的实体!
  5. 在查询中使用所有“种类”!
  6. 确保 datastore-indexes-auto-xml 已更新 [我有时甚至重新启动 eclipse]
  7. 部署到 appengine。
  8. 刷新浏览器上的数据索引视图。
  9. 等到您看到索引在此处输入图像描述
  10. 请告诉 Google 修复此问题。
  11. 这提供了丰富的信息,但对我来说不起作用:在此处输入链接说明< /a>
  12. 这也提供了信息,但对我不起作用:在此处输入链接描述

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

  1. Make sure none of your Entities have illegal signs e.g. '&'.
  2. Open the Data Indexes view on appengine.google.com.
  3. Make sure you havn't deleted the datastore-indexes-auto-xml. [I do this routinely]
  4. Store an Entity of each "Kind"!
  5. Use all the "Kinds" in Queries!
  6. Make sure the datastore-indexes-auto-xml is updated [I sometimes even restart eclipse]
  7. Deploy to appengine.
  8. Refresh Data Indexes view on the browser.
  9. Wait until you see the indexesenter image description here
  10. Please tell Google to fix this.
  11. This was informative but didn't work for me: enter link description here
  12. This was also informative but didn't work for me: enter link description here
仲春光 2024-09-17 09:17:20

检查您的 index.yaml 文件并确保在那里指定了正确的索引等。

Check your index.yaml file and make sure the proper indices are specified there, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文