Hi Nick,
   Is that value (the 25 limit) available as an environment variable, i.e. 
to avoid hard coding it in the rare instance when the value is needed?

On Monday, February 15, 2016 at 2:47:41 PM UTC-5, Nick (Cloud Platform 
Support) wrote:
>
> According to the documentation on XG-Transactions 
> <https://cloud.google.com/appengine/docs/java/datastore/#Java_Cross_group_transactions>,
>  
> you should be able to operate on up to 25 entity groups in a cross-group 
> transaction. It does mention that it will fail if another transaction 
> running at the same time modifies any of those entity groups. This might be 
> happening, although only you would know your system to be able to say 
> definitively yes or no.
>
> If that isn't happening, I think it would be worth posting this, along 
> with simple code snippets allowing reproduction of the behaviour, in the 
> Public 
> Issue Tracker <https://code.google.com/p/googleappengine/issues/list>. We 
> do regular monitoring of the Public Issue Trackers and the issue would get 
> looked-at relatively quickly.
>
> Best wishes,
>
> Nick
>
> On Monday, February 15, 2016 at 11:23:50 AM UTC-5, Louise Elmose Hedegaard 
> wrote:
>>
>> I have a datastore with a kind "shop", a kind "order" and a kind 
>> "transaction".
>> One shop has many orders, and one order has many transactions.
>> The parent of a transaction is an order, the parent of an order is a shop.
>>
>> I want to delete all entries in the transactions table:
>>
>>     public void cleanUp() {
>>         Query query = new 
>> Query(TransactionDBFields.TRANSACTION_TABLE_NAME);
>>         query.setKeysOnly();
>>         query.setFilter(
>>                 new Query.FilterPredicate(
>>                         TransactionDBFields.CREATED_AT,
>>                         Query.FilterOperator.LESS_THAN_OR_EQUAL,
>>                         new Date())
>>         );
>>
>>         PreparedQuery preparedQuery = datastore.prepare(query);
>>         Iterable<Entity> entities = 
>> preparedQuery.asIterable(FetchOptions.Builder.withLimit(5));
>>
>>         TransactionOptions options = 
>> TransactionOptions.Builder.withXG(true);
>>         Transaction txn = datastore.beginTransaction(options);
>>         for (Entity en : entities) {
>>             datastore.delete(txn, en.getKey());
>>         }
>>         txn.commit();
>>     }
>>
>> If I change the limit to anything larger than 5 I get the error:
>>
>> java.lang.IllegalArgumentException: operating on too many entity groups 
>> in a single transaction.
>>
>> - apparently as GAE does not allow operating on more than 5 entity groups 
>> in a single transaction. 
>>
>> Is there a way to delete more than 5 entities at a time? executing the 
>> above code continuously to delete all transaction entities does not seem 
>> reasonable, nor when considering performance.
>>
>> -Louise
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/fddb8a15-ace7-41af-b108-6512398cf389%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to