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.

Was it helpful?

Solution

I'd recommend using something like the MapReduce library or at least using the Task Queue for deleting in batches of hundreds or so.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top