Take the 2-minute tour ×

I perform batch delete operation on entity keys using DatastoreService.delete(Key... keys). Each entity is a root entity, so operation is executed without transaction. The batch size is hardcoded and the deletion is performed step by step. Each following operation firstly execute key-only get query to fetch entity keys using cursor received from previously executed get query and then performs batch delete query. Scheme seems to work fine, but what if an exception occurs while delete query?

Is there any way to get a number of successfully deleted entites, or a cursor of the first not deleted entity? And could you please clarify how this operation is performed in GAE on low-level.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

If an exception occurs, some undefined subset of entities have been deleted. There is not currently any way to get a list of which ones were deleted.

Your best option is to simply retry the whole batch delete operation again.

share|improve this answer
Thank you very much for your answer. The only question left is: should i use cursor (query.startCursor) when doing retry attempt or should i run it omitting cursor? –  Peter Apr 19 '12 at 21:29
@Peter Actually, I meant that you should retry the deletion with the list of keys you already have. –  Nick Johnson Apr 20 '12 at 0:15

Your Answer


