[openstreetmap-website] Fix bug allowing created elements to reference deleted ones. (#992)
Matt Amos
notifications at github.com
Sat Jun 13 00:09:20 UTC 2015
The bug allows a newly-created element to refer to a deleted one if the transactions for both overlap. Precisely, the issue is that the check that an element exists does not prevent a concurrent transaction from altering that row.
Because "deleting" an element in the OSM database does not remove the row, we cannot rely on FK constraints to ensure the correct behaviour. Instead, this fix relies on manually locking referenced elements.
Note that this "fix" is suboptimal, as it does not allow any updates to the referenced elements. Updates which do not delete the row could safely be done, but will be prevented.
Also, it's not clear what the negative performance impact of this change will be.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/992
-- Commit Summary --
* Fix bug allowing created elements to reference deleted ones.
-- File Changes --
M app/models/relation.rb (3)
M app/models/way.rb (4)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/992.patch
https://github.com/openstreetmap/openstreetmap-website/pull/992.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/992
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20150612/90a1016b/attachment.html>
More information about the rails-dev
mailing list