On Feb 18, 2008 9:42 AM, Tom Hughes <[EMAIL PROTECTED]> wrote:
> That still has race conditions unless you can do the check in an
> atomic fashion, which I'm not sure you can.

It can work: For inserting/updating ways you're checking the nodes
exist already, add a FOR SHARE to each query
This stops someone else deleting them in the meantime. And a FOR
UPDATE on the way against concurrent updates. For deleting a node, in
the initial existance check add a FOR UPDATE to the query. Now check
the ways/relations (nothing special needed here). Finally delete the
node.

It's poor man's referential integrity, but it's what Real Databases do
in the background when doing referential integrity.

> Well obviously we could just lock everything, but the users of
> the API probably wouldn't like the result much.

AFAICS it doesn't require any additional queries so the performance
effect should be marginal. But it probably only works for innodb
tables :(

Have a nice day,
-- 
Martijn van Oosterhout <[EMAIL PROTECTED]> http://svana.org/kleptog/

_______________________________________________
dev mailing list
[email protected]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev

Reply via email to