views:

51

answers:

3

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!?

A: 

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

Amber
+1  A: 

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.

corydoras
Indexes are built when the index definition file, generated by the SDK, is uploaded to the server. Unlike the SDK, the production environment doesn't automatically build indexes when queries are executed.
Nick Johnson
+2  A: 

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

jonmiddleton