3

We use the Google Cloud Datastore Emulator. It autogenerates indexes.yaml. But as we did with the old Google Plugin for Eclipse, we want to get missing-index messages in the local development environment, and not later in cloud deployment. So, we want the Emulator to use our manually-maintained datastore-indexes.xml

How do we configure the use of a specific datastore-indexes.xml in the Google Cloud Datastore Emulator? I don't see any relevant command-line switches in the help text.

Joshua Fox
  • 18,704
  • 23
  • 87
  • 147

1 Answers1

4

EDIT:

My answer was based on the dev_appserver emulator, not the current one. After running some tests, it appears that the emulator only has endpoints for a subset of the Datastore API methods, and index building (nor export/import for that matter) are available.

Leaving my previous answer to avoid repeated answers with the same wrong info:

_________

According to the docs, if autoGenerate="false" is in your datastore-indexes.xml, the development server should ignore the contents of WEB-INF/appengine-generated/datastore-indexes-auto.xml.

I think this might be what you're looking for, although I have not yet tested it.

Jofre
  • 3,718
  • 1
  • 23
  • 31
  • Thank you. That seems related, but refers to Datastore in GCP rather than the Cloud Emulator. The Emulator looks at index.yaml and would never see the directive inside datastore-indexes.xml. So how do we get the Emulator to look at , datastore-indexes*.xml instead. – Joshua Fox Aug 07 '18 at 08:20
  • 1
    The sentence on the docs state: "If autoGenerate="false" is in your datastore-indexes.xml, the **development server** and AppCfg ignore the contents of datastore-indexes-auto.xml." (emphasis mine). I assumed it would work with the emulator, but it could also not be working. Have you been able to try it? – Jofre Aug 07 '18 at 08:35
  • 1
    The GAE development server (part of the obsolete Cloud Tools for Eclipse) uses datastore-indexes.xml. The newer Cloud Datastore Emulator doesn't. How do we point the Emulator at datastore-indexes.xml? – Joshua Fox Aug 07 '18 at 10:15
  • 1
    It looks like [the code](https://github.com/GoogleCloudPlatform/google-cloud-eclipse/blob/master/plugins/com.google.cloud.tools.eclipse.appengine.localserver/src/com/google/cloud/tools/eclipse/appengine/localserver/server/DatastoreIndexUpdateData.java#L40) looks for the `datastore-indexes.xml` file, so I'm not sure what is going on. – Jofre Aug 07 '18 at 10:34
  • OK, so I deleted index.yaml from underneath my usual Emulator dir. Then I pasted a copy of datastore-indexes.xml with autoGenerate=false in ALL subdirs so that the listing is as follows. I then ran the Emulator. But it still doesn't know that it is supposed to look for datastore-indexes.xml and instead genrates and uses index.yaml as usual (files WEB-INF/appengine-generated/local_db.bin; WEB-INF/appengine-generated/datastore-indexes.xml; WEB-INF/datastore-indexes.xml; datastore-indexes.xml) – Joshua Fox Aug 07 '18 at 10:55
  • That code that you linked to is in the "Google Cloud Tools for Eclipse." Following discussion with the team that developed that tool, we do not use it. We use the Cloud Datastore Emulator. https://cloud.google.com/datastore/docs/tools/datastore-emulator What does the code for that say? – Joshua Fox Aug 07 '18 at 11:10
  • 1
    I've been checking the new Datastore Emulator, and it does not look like it can accept indexes. Apparently, it only accepts a [subset of the Cloud Datastore API methods](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects), and the create indexes is not one of them. It does generate an index.yaml so you can create those indexes in the cloud, but it does no look like it can accept any manual indexes at the moment. – Jofre Aug 07 '18 at 15:10
  • Thank you. How can we start a meaningful discussion about this lack? – Joshua Fox Aug 08 '18 at 08:11
  • If necessary, we can autoconvert our datastore-indexes.xml to index.yaml and feed that into Datastore Emulator. But if it does not accept manual index files of any type, our development process is disrupted as we do not see the error messages until the QA phase of the sprint. – Joshua Fox Aug 08 '18 at 08:16