Here is my code fragment. This code works very fine with local development data store. But doesn't work on real app engine. The query filter used here only returns 181 rows.
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.FetchOptions;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.datastore.Query.FilterOperator;
Query query = new Query("Share");
query.addFilter("timeOfData", FilterOperator.GREATER_THAN, sdf.parse(date));
query.setKeysOnly();
ArrayList<Key> allKeys = new ArrayList<Key>();
if(numberOfRowsToBedeletedAtOnceString != null)
numberOfRowsToBedeletedAtOnce = Integer.parseInt(numberOfRowsToBedeletedAtOnceString);
for (final Entity e : dcc.prepare(query).asIterable(FetchOptions.Builder.withLimit(numberOfRowsToBedeletedAtOnce)))
{
allKeys.add(e.getKey());
}
allKeys.trimToSize();
dcc.delete(allKeys);
out.print("Deleted By Date count : " + allKeys.size());
out.flush();
out.close();