How can I programmatically determine which Datasto

2019-05-10 23:25发布

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

1条回答
何必那么认真
2楼-- · 2019-05-11 00:00

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.

查看更多
登录 后发表回答