[openstreetmap/openstreetmap-website] Global element versioning (Issue #4660)

Anton Khorev notifications at github.com
Mon Apr 8 13:02:43 UTC 2024


### Problem

Sometimes the code tries to reproduce the sequence of element modifications but the data to do this is not directly available.

Changeset downloads rely primarily on timestamps, and then additionally sort by version, type etc and it's done differently in [osm-website](https://github.com/openstreetmap/openstreetmap-website/blob/0c4cbda662502f05646a4e82f5d8f639b9183059/app/controllers/api/changesets_controller.rb#L158) and [cgimap](https://github.com/zerebubuth/openstreetmap-cgimap/blob/2fa2d702017ddd136555e3562f574ac91870e8bc/src/osmchange_responder.cpp#L32). This additional ordering may not be correct. For example, it makes sense to reverse ordering by type for deletions. Relying on the additional ordering becomes necessary if timestamps are truncated, and that may happen if the data is restored from a dump.

Changeset webpages show lists elements. Those also reproduce the modification sequence in most of the cases but that happens as a side-effect of them not being sorted. This lack of sorting causes problems elsewhere and so does assuming that the elements are not sorted, see https://github.com/openstreetmap/openstreetmap-website/pull/4571.

### Description

Is it feasible to do this thing?
https://github.com/openstreetmap/openstreetmap-website/blob/0c4cbda662502f05646a4e82f5d8f639b9183059/app/controllers/api/changesets_controller.rb#L154-L157

1. Create one sequence to serve three old element tables.
2. Start it at a large enough number.
3. Add a column to each old element table with a default value taken from this sequence. This should work with db clients that don't yet know about this column but insert elements.
4. Backfill the column according to [this order](https://github.com/zerebubuth/openstreetmap-cgimap/blob/2fa2d702017ddd136555e3562f574ac91870e8bc/src/osmchange_responder.cpp#L32). It's not necessarily correct, maybe update it later.
5. Use this global version column for ordering (old) elements inside changesets on osm website and in other places.

### Screenshots

_No response_

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/4660
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/4660 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240408/1646e1a2/attachment.htm>


More information about the rails-dev mailing list