[OSM-dev] [OSM-talk] Trouble in Rangoon
tom at compton.nu
Thu Feb 28 13:01:56 GMT 2008
In message <47C6AD5B.7040205 at wolschon.biz>
Marcus Wolschon <marcus at wolschon.biz> wrote:
> Tom Hughes schrieb:
> | In message <47C69D6C.5040104 at wolschon.biz>
> | Marcus Wolschon <marcus at wolschon.biz> wrote:
> |> In the end we really need something like
> |> the history-tab in wikipedia without breaking
> |> referential integrity uppon restores. Once
> |> accidents and vandalism becomes more common
> |> there is not much of a way around that.
> | That's basically not possible - we can't even maintain proper
> | referential integrity on ordinary uploads so how you expect to
> | maintain it through a bulk restore is beyond me.
> We do not check that
> * uploaded way_nodes have existing nodes
> * uploaded relations have existing items
> * removed ways have no way_nodes anymore
> * removed nodes have not way_nodes or relations anymore?
We do, but as we don't have transactions it doesn't help as those
checks and the subsequent changes do not constitute a single atomic
operation. Hence if somebody else makes changes at the same time
or an error occurs you can break referential integrity.
That only gets worse as the set of operations gets bigger, as it
would in a rollback scenario.
> | For example you can do:
> | SELECT *
> | FROM nodes
> | WHERE tile IN (...) AND timestamp <= ...
> | but that will get you all versions of each node that predate
> | the given timestamp. Which might be a lot more data than you
> | want.
> SELECT *, MAX(version)
> ~ FROM nodes
> ~ WHERE tile IN (...)
> ~ AND timestamp <= XYZ
> ~ group by node_id
Do you have any idea how slow that will be with mysql... Not that
it would actually run as you can only select things in the group
by and aggregates when grouping. You would have to select the id
and then go back and get the details. Which isn't something rails
can easily do (you could do it, but it's a bit too raw SQL for
Steve's liking I suspect ;-)).
Tom Hughes (tom at compton.nu)
More information about the dev