google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

same query on a data range gives different count #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I query the SAME date range again and again like this:

        return db.query(MyThingy.class)
            .filter("registrationDate >=",startDate)
            .filter("registrationDate <",endDate)
            .order("registrationDate")
            .count();

I may sometimes get a count of 200, other times 196, 203, or 200!
Note: all my dates are with 0:0:0 in the H:M.S part,

I am on GAE 1.5.2 and Objectify 3.0b2

I added a calculated field to find MyThingy within the date range of a month
and using the code below I do get the expected result:

        int ym = (year*100) + month;
        return db.query(MyThingy.class)
        .filter("registrationMonth =",ym)
        .count();

But I don't like this - I would like to know what is wrong. (me or GAE or Ofy)

Original issue reported on code.google.com by f...@strong.no on 31 Aug 2011 at 7:26

GoogleCodeExporter commented 9 years ago
Objectify just passes the query through to the underlying Low-Level API - we 
don't do any counting ourselves.  If you want to be absolutely certain, you can 
test this by writing a low-level api query.

Are you using the High-Replication Datastore?  Is it possible you are seeing 
eventual consistency behavior?  Counts are created by following indexes, and 
each datacenter may have a different version of the index at any given time.  
Any given query might be served by any datacenter.

Original comment by lhori...@gmail.com on 31 Aug 2011 at 10:02

GoogleCodeExporter commented 9 years ago
I am running the query within a few seconds delay, same form submit, same 
session. That is why I find it to be strange.  But I do have this: (the default 
setting)

Datastore Replication Options:
Master/Slave Replication
Uses a master-slave replication system, which asynchronously replicates data, 
as you write it, to another physical datacenter.

But this is ONLY when I use dates, not when I query the same data using an int 
calculated to give me the month (my quick and dirty y*100+m). When I query this 
I always get the correct count.

Original comment by f...@strong.no on 31 Aug 2011 at 10:10

GoogleCodeExporter commented 9 years ago
I'm going to close this because it's very old, seems highly unlikely to be 
Objectify related, and the relevant Objectify code has been rewritten several 
times anyways. If there are future issues like this, please open another ticket.

Original comment by lhori...@gmail.com on 14 Apr 2014 at 12:24