Thanks for the suggestions. It's not an eventual consistency issue,
and I get datastore timeout exceptions so there can't be a blind try-
except. The code does a put() for one or more entities inside
run_in_transaction(), then does a raw put() for another entity. Here's
the simplified code:
logItems=''
for id in ids:
db.run_in_transaction(updateEntity,id,newTime)
logItems+=rh.logItem('B',newTime)
entity2.log+=logItems
entity2.put()
The put() in updateEntity() works, the entity2 put() fails without an
exception. The only reason I know this is that when I compare the log
data in entity2 it doesn't match the data in the updated entities.
This only happens once per 10,000 times, and I was lucky to catch two
recent cases - the time logged by the successful updateEntity() call
corresponding to the missing entity2 entry exactly matches the
"Transaction collision. Retying..." warning in the logs in both cases.
There are a few questions this raises:
1. I have assumed that the "Transaction collision. Retying..." warning
is caused by the updateEntity(), because it's in a
run_in_transaction(). But given the entity2.put() is the one failing,
perhaps that is the source? Can you get transaction collision warnings
from non-transactional put()s?
2. Surely no matter what I should get an exception if the
entity2.put() fails?
Thanks again for your help with this.
Greg.
On Jul 8, 2:51 am, Robert Kluin <[email protected]> wrote:
> Hey Greg,
> Do you have any blind try-excepts in your code? If it is silently
> failing, I'd guess something issilently catching and ignoring the
> exception.
>
> Also, as Noah mentioned, a global query immediately after a put
> might not get the latest results. A get-by-key or ancestor query
> will.
>
> Robert
>
>
>
>
>
>
>
>
>
> On Wednesday, July 6, 2011, Greg <[email protected]> wrote:
> > Hi -
>
> > I've just discovered that occasionally put()s in my python HR
> > datastore app are failing almost silently. "Almost" because I am
> > seeing a "Transaction collision. Retying..." warning logged at the
> > time the write is supposed to happen, but nothing else - certainly no
> > exception is raised.
>
> > This is severely impacting the integrity of my data. I'm currently
> > running a remote checking script daily to fix the data, but this is a
> > horrible band-aid and should not be required. Either the put() should
> > succeed, or an exception should be raised.
>
> > Any ideas?
>
> > Cheers
> > Greg.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/google-appengine?hl=en.
>
> --
> ------
> Robert Kluin
> Ezox Systems, LLC
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.