]> git.openstreetmap.org Git - rails.git/commit
Fix bug allowing created elements to reference deleted ones
authorMatt Amos <zerebubuth@gmail.com>
Sat, 13 Jun 2015 09:59:11 +0000 (10:59 +0100)
committerTom Hughes <tom@compton.nu>
Sat, 13 Jun 2015 09:59:57 +0000 (10:59 +0100)
commitcf6a5c17ee15eeee6035b7c99996b411f08cc9c1
treefe95e52814dcb81c288907a864c4e517896017a6
parent891ec3d75cdb93a97759c2311ad8e1b559421280
Fix bug allowing created elements to reference deleted ones

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.
app/models/relation.rb
app/models/way.rb