Opened 5 years ago

Last modified 4 years ago

#5312 new defect

Osmosis should sync files to disk during replication

Reported by: Tom Hughes Owned by: bretth
Priority: minor Milestone:
Component: osmosis Version:
Keywords: Cc: mmd, Jocelyn


If a machine that is running replication crashes then, with a modern logging file system, it is likely that when it reboots the most recent file will exist but without a contents.

That can be fixed by deleting those files so that replication restarts from the previous state, but any client which had already downloaded the old version before the crash will miss some edits, as the new version of that file will be larger and won't be downloaded again.

To minimise this risk it would be good to sync the files after they are created.

Change History (4)

comment:1 Changed 5 years ago by mmd

Adding a few comments from a data consumer point of view:

According to the Overpass API status page, the data replication was hit by this bug at least twice this year. Generating the same diff file a second time with different contents will usually go unnoticed, causing later database inconsistency issues and generally loss of data (changesets only contained in the second diff write are lost).

As of today, this can only be resolved by time consuming manual repair activities or even restoring a backup and reapplying minutely diffs, during which Overpass API will serve outdated information.

It would be really helpful to have this issue analyzed in more detail and possibly even fixed. Dealing with empty diff files is not a concern. In the current case, the diff file was initially written with a size of 48375 bytes and again after the crash with a size of 2.2M.

Please also refer to this Github ticket for more details:

Last edited 5 years ago by mmd (previous) (diff)

comment:2 Changed 5 years ago by mmd

Cc: mmd added

comment:3 Changed 4 years ago by Jocelyn

Wouldn't a better fix be to write temporary files before moving them to the final location ? Move operation is supposed to be an atomic operation, and if the .osm.gz is moved before the state.txt file, then no issue should be seen anymore.

comment:4 Changed 4 years ago by Jocelyn

Cc: Jocelyn added
Note: See TracTickets for help on using tickets.