I'd recommend using something like the MapReduce library or at least using the Task Queue for deleting in batches of hundreds or so.
Delete 100000 records from datastore using java
-
05-07-2023 - |
Question
Program to delete 100000 records in bulk from datastore using java.Currently i am doing.
public void deleteExistingResults() throws InterruptedException {
log.info("inside deleteExistingResults");
ArrayList<Key> keys = new ArrayList<Key>();
List<Entity> results = getResults();
for (Entity entity : results) {
keys.add(entity.getKey());
}
log.info("deleteExistingResults:outside loop");
service.delete(keys);
}
where getResults return all the keys from datastore.I am getting this error. com.insightsapp.cron.controller.CronTask runTask: Encountered an exception too much contention on these datastore entities. please try again.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow