Closed gmaclennan closed 8 years ago
Fixed in 1.12.1. The problem was that the if-unsued
calculation in lib/del.js
did not take into consideration if a way or relation was modified in the current batch, which may change if a node is unused.
@substack, just to be clear here that the code is matching the spec: basically the DB should never delete a node/way/relation that is used in another way/relation. Normally it would throw an error if you tried, but what if-unused
does it tell the API to 'silently fail' when you try to delete something that is used. I haven't looked through this part of the code but I wanted to make sure this is what we are doing.
The DB will throw an error if you try to delete something that hasn't been used and if-unused isn't set.
If you create a new way, and commit the changes, then modify the way to remove some of the nodes, deleting the now unused nodes, the data does not actually get deleted from the db.
I have created a failing test: https://github.com/digidem/osm-p2p-server/blob/master/test/split_delete_way.js
There seem to be two parts to this error: one, deleted nodes are not being deleted from the db, despite not being used in any way (if they are not used, they should be deleted).
It also seems like there is an error upstream in the indexing. Querying the way directly only returns one version (i.e. no forks) but the bbox request returns both the original version and the modified version - i.e. the bbox query (built from the index) has two versions, but it seems like there is only one fork.
This problem I think is at a root of a lot of problems we have had with the Waorani database.
This is the xml returned by the bbox query after running the test. Directly querying way id
12059823620099955508
returns only one version, but the bbox has two.