[Tile-serving] [openstreetmap/osm2pgsql] If there is a network error when trying to get replication status, print a more useful error message, and tell exit (PR #1972)
Amanda
notifications at github.com
Mon Jun 5 09:50:21 UTC 2023
When doing osm2pgsql-replication, if there's a network error, print that error to stdout & exit with failure code.
Previously, the `osm2pgsql-replication` would do this:
```
$ osm2pgsql-replication update -U osm -d "gis" -- --multi-geometry --hstore --flat-nodes /nvme/flatnodes-tile/flatnodes.dat --style /srv/openstreetmap-carto/openstreetmap-carto.style --tag-transform-script /srv/openstreetmap-carto/openstreetmap-carto.lua --middle-way-node-index-id-shift 5
2023-06-05 05:47:27 [INFO]: Using replication service 'https://planet.openstreetmap.org/replication/minute/'. Current sequence 5589863 (2023-05-25 10:05:54+02:00).
Traceback (most recent call last):
File "/usr/bin/osm2pgsql-replication", line 531, in <module>
sys.exit(main())
File "/usr/bin/osm2pgsql-replication", line 524, in main
ret = args.handler(conn, args)
File "/usr/bin/osm2pgsql-replication", line 359, in update
if seq >= current.sequence:
AttributeError: 'NoneType' object has no attribute 'sequence'
```
With this patch, it does this:
```
$ osm2pgsql-replication update -U osm -d "gis" -- --multi-geometry --hstore --flat-nodes /nvme/flatnodes-tile/flatnodes.dat --style /srv/openstreetmap-carto/openstreetmap-carto.style --tag-transform-script /srv/openstreetmap-carto/openstreetmap-carto.lua --middle-way-node-index-id-shift 5
2023-06-05 05:48:59 [INFO]: Using replication service 'https://planet.openstreetmap.org/replication/minute/'. Current sequence 5589863 (2023-05-25 10:05:54+02:00).
2023-06-05 05:49:02 [CRITICAL]: Cannot reach the configured replication service 'https://planet.openstreetmap.org/replication/minute/'.
Does the URL point to a directory containing OSM update data?
```
which is a more helpful error message.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/osm2pgsql/pull/1972
-- Commit Summary --
* If there is a network error when trying to get replication status, print a more useful error message, and tell exit
-- File Changes --
M scripts/osm2pgsql-replication (5)
-- Patch Links --
https://github.com/openstreetmap/osm2pgsql/pull/1972.patch
https://github.com/openstreetmap/osm2pgsql/pull/1972.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1972
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/osm2pgsql/pull/1972 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20230605/a75bb007/attachment.htm>
More information about the Tile-serving
mailing list