java - GAE datastore: Entity deleted only after multiple calls to delete() -


i'm playing gae datastore on local machine eclipse. i've created 2 servlets - addmovie , deletemovie:

addmovie

entity movie = new entity("movie",system.currenttimemillis()); movie.setproperty("name",     "hakeshset beanan"); movie.setproperty("director", "godard"); datastore.put(movie); 

deletemovie

query q = new query("movie"); preparedquery pq = datastore.prepare(q); list<entity> movies = lists.newarraylist(pq.asiterable()); response.put("nummoviesfound", string.valueof(movies.size()));  (entity movie : movies) {     key key = movie.getkey();     datastore.delete(key); } 

the funny thing deletemovie servlet not delete movies. consecutive calls return {"nummoviesfound":"15"}, {"nummoviesfound":"9"}, {"nummoviesfound":"3"} , {"nummoviesfound":"3"}.

why aren't movies deleted datastore @ once?

update: problem seem happen on local eclipse, not on gae servers.

i think should delete movies in single transaction, ensure better consistency.

talking consistency, problem right here :

google app engine's high replication datastore (hrd) provides high availability reads , writes storing data synchronously in multiple data centers. however, delay time write committed until becomes visible in data centers means queries across multiple entity groups (non-ancestor queries) can guarantee consistent results. consequently, results of such queries may fail reflect recent changes underlying data.

https://developers.google.com/appengine/docs/java/datastore/structuring_for_strong_consistency


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -