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 google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
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/3377bed8-3cd6-4a7d-955d-3f97325a8292%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to