digidem / osm-p2p-server

Peer-to-peer OpenStreetMap API v0.6 Server for osm-p2p-db
BSD 2-Clause "Simplified" License
87 stars 10 forks source link

[WIP] Fix "orphaned nodes" case #35

Closed hackergrrl closed 6 years ago

hackergrrl commented 6 years ago

This scenario is pretty easy to set up:

  1. Create 3 nodes
  2. Create a way that points to those nodes
  3. Modify that way to no longer include one of these nodes
  4. Subsequent OSM queries will return the node that is no longer referenced

So far this PR only reproduces the issue. Solving this is tougher, since this case looks almost identical to the case where there is simply a standalone node that no way references!

hackergrrl commented 6 years ago

A couple of solutions:

  1. Maintain an index of "obsolete refs", so that node IDs can be looked up check if they once (but no longer) belonged to a way.
  2. Modify osm-p2p-server to perform deletions on orphan nodes when ways are modified.

I'm partial to (2). It doesn't fix existing data, but we can do manual deletions on those in Mapeo.

hackergrrl commented 6 years ago

It looks like iD Editor already does (2) -- thanks for pointing this out @gmaclennan. The only way I could see this scenario happening then is when there's a fork on a node member of a way: one is a modification and one is a deletion. The way that does the deletion "wins" the defork sort and gets rendered, and the node modification "wins" and gets rendered, resulting in a "ghost point". This is a bigger issue, which can be fixed with https://github.com/digidem/osm-p2p-db/issues/49.

Closing this PR for now. I think the best we can do for Mapeo users is to advise them to manually delete ghost points that occur. Thanks to https://github.com/digidem/osm-p2p-db/pull/53 deletions shouldn't be ignored any more.