[appengine-java] Re: Task Enqueue in a Transaction

2011-03-22 Thread Didier Durand
Hi,

For me, the answer is here:
http://code.google.com/appengine/docs/java/datastore/transactions.html#Isolation_and_Consistency

They say: "Queries and gets inside a transaction are guaranteed to see
a single, consistent snapshot of the datastore as of the beginning of
the transaction. In particular, entities and index rows in the
transaction's entity group are fully updated so that queries return
the complete, correct set of result entities, without the false
positives or false negatives described in Transaction Isolation that
can occur in queries outside of transactions."

The task is part of the initial transaction so it sees the ds as of
the beginning of the transaction

regards

didier

On Mar 22, 9:12 pm, Tom Gibara  wrote:
> Thanks for the link, somehow I'd managed to miss that page of
> documentation entirely*; it's good to know, though it indicates other
> problems for the OP.
>
> I'm not clear on why eventually consistent gets aren't an option, ie.
> why all gets are indicated as being strongly consistent. Is this a
> direct consequence of replication algorithm used? There are various
> places in the code I'm currently developing where dirty gets are
> adequate and I'd be happy to see them faster.
>
> * As an aside, I do find the documentation on the datastore feels very
> scattered. I'd much prefer sections on the underlying app engine
> mechanics with less language specific guidance.
>
> Tom.
>
> On 22 March 2011 17:59, Jay Young  wrote:
>
> > According to the docs, gets, puts, deletes, and ancestor queries are all
> > strongly consistent:
> >http://code.google.com/appengine/docs/java/datastore/hr/
>
>

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



[appengine-java] Re: Task Enqueue in a Transaction

2011-03-23 Thread Simon Knott
The enqueuing of the task is all that is encompassed by the transaction.

I'm sure I read a post by Ikai the other day which stated that Gets were 
wrapped 

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



[appengine-java] Re: Task Enqueue in a Transaction

2011-03-23 Thread Simon Knott
The enqueuing of the task is all that is encompassed by the transaction.

I'm sure I read a post by Ikai the other day which stated that a Get is wrapped 
in a transaction in the background - I'll try wrapping it manually to see if 
that solves the problem.

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



[appengine-java] Re: Task Enqueue in a Transaction

2011-03-23 Thread David Gay
Tom Gibara  Mar 22 08:12PM wrote:
> Thanks for the link, somehow I'd managed to miss that page of
> documentation entirely*; it's good to know, though it indicates other
> problems for the OP.
>
> I'm not clear on why eventually consistent gets aren't an option, ie.
> why all gets are indicated as being strongly consistent.

You can get eventually-consistent gets with the HR datastore if you
create a DatastoreServiceConfig with

  myPolicy = 
DatastoreServiceConfig.withReadPolicy(ReadPolicy.Consistency.EVENTUAL)

and use that policy when creating your datastore service (i.e., the
same way you get eventually consistent gets with the master-slave
datastore).

--
David Gay - AppEngine
d...@google.com

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



Re: [appengine-java] Re: Task Enqueue in a Transaction

2011-03-23 Thread Tom Gibara
That's not how I understood the documentation, and it isn't my
experience either.

http://code.google.com/appengine/docs/java/datastore/transactions.html

This page explicitly states that it's the enqueing of the task which
is subject to the transaction. It says nothing about its execution.
When the task runs, it's free to do what ever work it wants to,
including opening one or more transactions.

I use the same pattern as the OP (except with a transaction around the
get by key), and on the development server at least, it always sees
the latest state of the datastore (post its enqueing transaction).
Unfortunately the code hasn't transitioned to Google's servers for
testing yet.

Tom.

On 23 March 2011 05:26, Didier Durand  wrote:
> Hi,
>
> For me, the answer is here:
> http://code.google.com/appengine/docs/java/datastore/transactions.html#Isolation_and_Consistency
>
> They say: "Queries and gets inside a transaction are guaranteed to see
> a single, consistent snapshot of the datastore as of the beginning of
> the transaction. In particular, entities and index rows in the
> transaction's entity group are fully updated so that queries return
> the complete, correct set of result entities, without the false
> positives or false negatives described in Transaction Isolation that
> can occur in queries outside of transactions."
>
> The task is part of the initial transaction so it sees the ds as of
> the beginning of the transaction
>
> regards
>
> didier
>
> On Mar 22, 9:12 pm, Tom Gibara  wrote:
>> Thanks for the link, somehow I'd managed to miss that page of
>> documentation entirely*; it's good to know, though it indicates other
>> problems for the OP.
>>
>> I'm not clear on why eventually consistent gets aren't an option, ie.
>> why all gets are indicated as being strongly consistent. Is this a
>> direct consequence of replication algorithm used? There are various
>> places in the code I'm currently developing where dirty gets are
>> adequate and I'd be happy to see them faster.
>>
>> * As an aside, I do find the documentation on the datastore feels very
>> scattered. I'd much prefer sections on the underlying app engine
>> mechanics with less language specific guidance.
>>
>> Tom.
>>
>> On 22 March 2011 17:59, Jay Young  wrote:
>>
>> > According to the docs, gets, puts, deletes, and ancestor queries are all
>> > strongly consistent:
>> >http://code.google.com/appengine/docs/java/datastore/hr/
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

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