title: Google Datastore - ancestor query doesn't appear to be strongly consistent if entity does not exist
body: <p>Suppose you have a method like this:</p>
  
  <pre><code>Entity entity = ofy().load().type(Entity.class)
          .ancestor(key)
          .filter("someField", someValue)
          .first().now();
  
  if (entity == null) {
      // Entity does not exist yet.
      // Write new entity to Datastore.
  }
  </code></pre>
  
  <p>The method checks if a certain entity exists via an ancestor query. If it does not, it writes it to the datastore.</p>
  
  <p>One thing I have found is that if the above method is executed twice at the exact same time, then two entities are written. It appears that <code>entity</code> is still seen as null due to a race condition.</p>
  
  <p>I thought that ancestor queries are supposed to be strongly consistent and thus prevent the above scenario? It appears it is not strongly consistent when an entity does not exist.</p>
  
  <p>Is there a way to prevent two entities from being written in the above case?</p>