[OSM-dev] Data corruption :) II

Dave Stubbs osm.list at randomjunk.co.uk
Mon Nov 24 11:36:42 GMT 2008


2008/11/24 Stefan de Konink <stefan at konink.de>:
> Dave Stubbs wrote:
>>
>> There was a Potlatch bug early on (my fault), which has now been
>> fixed, that'll be responsible for referencing the low numbered nodes.
>
> Resolvement scenario? Undelete or remove members?
>

Just remove members -- there's no useful information to recover as the
user never intended to link these nodes (the bug was that the node
index in the way was linked instead of the node ID). You could
probably try to reconstruct the intended node ID, but it'll always be
a guess.


>
>> The root of the problem, however (as has been stated many times
>> before), is lack of transactions and foreign key constraints in the
>> 0.5 API.
>> This is being fixed in the 0.6 API.
>
> Foreign key constraints are part of the typical database; not an API matter.
> If implemented it still wouldn't require transactions only a proper order of
> querying.
>

I'm talking about the API code inclusive of the database schema,
rather than the exposed API itself.

And yes, you need transactions because the problem is that somebody
could be busy deleting a node at the same time as you're adding it to
a relation. The transactions don't need to be very big for this small
use case, but they need to exist. It's entirely possible your database
quite sensibly always considers referential constraints
transactionally with the update.

Note that we also have the issue that relations should reference only
visible ways/nodes/relations. This is a more complex integrity problem
depending on your exact database schema, and how you handle deletions,
which you may not be able to express completely in the database engine
itself.

Dave




More information about the dev mailing list