I think i solved the problem. The Entry.exists call was inside an
async urlfetch callback. I had this :
http://groups.google.com/group/google-appengine-python/browse_thread/thread/0230d030d8407de7
problem with Datastore puts inside callbacks. But the gets seemed to
work because they didnt raise any Exceptions, instead they were
returning inconsistent results. It got fixed when i rearranged some of
the stuff so that the put can be done outside callback.

On Dec 19, 10:04 am, johnP <j...@thinkwave.com> wrote:
> z33m - just looked at your thread, and see that the query in question
> is similar to
>   info = cls.all().get()
>
> My situation was similar.  Before allowing a person to be deleted, I
> check if the person has any data, by doing something similar to:
> has_data = person.data_set.get()
> if has_data:
>    return error message saying clear data before deleting
> else:
>    delete person
>
> So one case was where a person got deleted, but there was data.
> Understood - there can be something in my code.  But after tracing the
> logs, speaking with the user to be sure he acted as expected, and
> looking carefully enough to be pretty sure that the code is generally
> OK led me to a preliminary conclusion to wait and see if something
> similar reoccurs.  btw - this incident occurred pretty close to an
> Appengine deployment period.
>
> In general, these kinds of cases are fairly rare.  And experience
> shows that whenever I'm sure that the datastore's at fault, I
> eventually find the real bug in my code :)
>
> johnP
>
> On Dec 18, 7:32 pm, z33m <mailsforaz...@gmail.com> wrote:
>
>
>
> > This is actually not the first time for me either. I've had a similar
> > problem some months back 
> > :http://groups.google.com/group/google-appengine/browse_thread/thread/...
> > . Not sure if they are related or not. But in either case the
> > Datastore seemed to return inconsistent data.
>
> > On Dec 19, 1:24 am, johnP <j...@thinkwave.com> wrote:
>
> > > That's an interesting question.  I've had two or three instances in
> > > the past few months where *it appeared* that a query returned None
> > > when it should have returned something (or an error, at least).  I'm
> > > not sure if this was the case, and do not claim it to be the case:)
> > > But in analyzing chains of events, it seemed that this could have been
> > > the root cause for certain situations.
>
> > > That's why I too am interested the answer to this question.
>
> > > johnP
>
> > > On Dec 18, 12:05 pm, z33m <mailsforaz...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > Im writing a simple feed crawler using tasks. Feed entries are stored
> > > > in Entry model. I use guids to check whether an entry exists or not,
> > > > to avoid entries from begin crawled more than once.. But my checking
> > > > mechanism seems to be failing..
>
> > > > Here is the check function and Entry model that i use..
>
> > > > class Entry(db.Model):
> > > >         guid = db.StringProperty()
> > > >         title = db.TextProperty()
>
> > > >         @classmethod
> > > >         def exists(cls, guid):
> > > >                 query = db.Query(cls, keys_only = True)
> > > >                 key = query.filter('guid =', guid).get()
> > > >                 if key:
> > > >                         logging.info('True : %s' % guid)
> > > >                         return True
> > > >                 else:
> > > >                         logging.info('False : %s' % guid)
> > > >                         return False
>
> > > > and i get strange logs like this
>
> > > > I 12-18 11:29AM 06.720 True :http://www.techcrunch.com/?p=129969
> > > > I 12-18 11:29AM 06.721 False :http://www.techcrunch.com/?p=129937
> > > > I 12-18 11:29AM 06.722 False :http://www.techcrunch.com/?p=129963
> > > > I 12-18 11:29AM 06.723 False :http://www.techcrunch.com/?p=129883
> > > > .... all other entries are False ....
>
> > > > I 12-18 11:19AM 00.745 True :http://www.techcrunch.com/?p=129969
> > > > I 12-18 11:19AM 00.754 True :http://www.techcrunch.com/?p=129937
> > > > I 12-18 11:19AM 00.763 True :http://www.techcrunch.com/?p=129963
> > > > I 12-18 11:19AM 00.770 True :http://www.techcrunch.com/?p=129883
> > > > .... all other entries are True ....
>
> > > > am i doing something wrong? .. how is it possible that the same query
> > > > that returned a key 10min ago return None now?

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to