如何以编程方式确定哪些数据存储区索引出错?

时间:2016-11-10 07:58:59

标签: google-app-engine google-cloud-datastore devops database-indexes

当我在Google Datastore上运行 update_indexes 时,我收到以下消息。它告诉我通过查看GUI确定哪些索引出错,然后删除这些索引。

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

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

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

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

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

1 个答案:

答案 0 :(得分:2)

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

我们的目标是明年某个时候有一个索引管理API(已经开始设计),我将确保这个关键用例是我们所涵盖的。