如何以编程方式确定哪些数据存储索引出错? [英] How can I programmatically determine which Datastore indexes are in error?

查看:157
本文介绍了如何以编程方式确定哪些数据存储索引出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google Datastore上运行 update_indexes 时,我会看到下面的消息。它告诉我通过查看GUI来确定哪些索引是错误的,然后删除这些索引。

我有200个错误索引,并将它们复制出来的GUI不可行。



(编辑:通过辛苦地从datastore-indexes.xml删除和添加索引,我们确定了一个有问题的索引。)



良好的devops程序要求我们自动执行此类操作。



如何确定哪些索引编程错误? (Python,bash,甚至Java都可以)。

 无法建立状态为ERROR的索引。要真空并重建索引:
1.创建index.yaml规范的备份。
2.从您的管理控制台确定处于ERROR状态的索引:https://appengine.google.com/datastore/indexes?&app_id=s~myproject
3.删除索引的定义在您的index.yaml文件中出现错误。
4.运行appcfg.py vacuum_indexes your_app_dir /
5.等到ERROR索引不再出现在您的管理控制台中。
6.将index.yaml文件的修改版本替换为原始文件。
7.运行appcfg.py update_indexes your_app_dir /


解决方案

不幸的是,云数据存储没有用于管理索引的公共API,而当前的命令行工具使用无法访问该信息的内部API。



我们打算在明年某个时候推出索引管理API(已经开始设计),我将确保这个关键用例是我们所覆盖的。


When I run update_indexes on Google Datastore I get the message below. It is telling me to determine which indexes are in error by looking at the GUI, then delete these indexes.

I have 51 erroneous indexes out of 200, and copying them out of the GUI is not feasible.

(Edit: By laboriously removing and adding indexes from the datastore-indexes.xml, we identified the one problematic index.)

Good devops procedure demands that we do this sort of thing automatically.

How does one determine which indexes are in error programmatically? (Python, bash, or even Java are OK.)

Cannot build indexes that are in state ERROR.To vacuum and rebuild your indexes:
1. Create a backup of your index.yaml specification.
2. Determine the indexes in state ERROR from your admin console: https://appengine.google.com/datastore/indexes?&app_id=s~myproject
3. Remove the definitions of the indexes in ERROR from your index.yaml file.
4. Run "appcfg.py vacuum_indexes your_app_dir/"
5. Wait until the ERROR indexes no longer appear in your admin console.
6. Replace the modified version of your index.yaml file with the original.
7. Run "appcfg.py update_indexes your_app_dir/"

解决方案

Unfortunately Cloud Datastore doesn't have a public API for managing indexes and the current command line tools use an internal API that doesn't have access to that information.

We're aiming to have an index management API sometime next year (already working on designs) and I'll make sure this key use case is something we cover.

这篇关于如何以编程方式确定哪些数据存储索引出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆