[Tile-serving] [osm2pgsql-dev/osm2pgsql] osm2pgsql-replication returns code 0 when output says "Error during diff download" (Issue #2206)
Ryan Lambert
notifications at github.com
Sat Jul 6 16:30:23 UTC 2024
<!-- Please don't use screenshots. Copy and paste the *text* output here if that's needed for context. -->
## What version of osm2pgsql are you using?
<!-- Paste output of `osm2pgsql --version` here. Please use the [latest
release](https://osm2pgsql.org/releases/) of osm2pgsql if at all
possible. -->
```
2024-07-06 09:58:11 osm2pgsql version 1.11.0
Build: RelWithDebInfo
Compiled using the following library versions:
Libosmium 2.20.0
Proj 7.2.1
Lua 5.4.2
```
## What operating system and PostgreSQL/PostGIS version are you using?
<!-- Also what Linux distribution if applicable, OS version? -->
Debian, Postgres 16, PostGIS 3.4 through the `postgis/postgis:16-3.4` Docker image.
## Tell us something about your system
<!-- How much RAM do you have, how many CPUs, bare metal or cloud setup? -->
Running Docker on my laptop, 12 cores, 64 GB RAM.
## What did you do exactly?
<!-- Please provide the command(s) you used including all options etc. Include
links to input files. -->
I attempted to update an old dev server's data using `osm2pgsql-replication` when the target database was too old to be updated from Geofabrik's download server. It had last been updated about 4 months ago, when Geofabrik's replication files are only available for ~ 90 days.
The command involved:
```bash
osm2pgsql-replication update -d postgresql://pgosm_flex:notyourpassword@172.16.0.170:5432/pgosm_dev?application_name=pgosm-flex \
-- \
--output=flex --style=./run.lua \
--slim
```
## What did you expect to happen?
I expected `osm2pgsql-replication` to exit with an return code other than 0. This would allow my code to detect the issue and report it properly. Based on the current osm2pgsql-replication docs it could potentially be considered a 3 (network error). I don't have a strong opinion if that is correct return code other than it should not be 0.
<!-- Describe in detail what you expected the above would do. -->
## What did happen instead?
The return code was 0, even though the update failed. The text output does correctly represent that there was an error.
```
[ERROR]: Error during diff download. Bailing out.
```
My project uses this return code to determine if this step worked properly. I created an issue in that project (https://github.com/rustprooflabs/pgosm-flex/issues/391) that documents a bit more of the detail. Downstream code relies on this output code to detect and report success/failure of the process. The approach I took to catching this scenario in my project was to add a step to parse of output lines to catch the error text (see https://github.com/rustprooflabs/pgosm-flex/pull/392). That does not feel like the right way to detect this problem.
<!-- Please describe what happened and why you think this is wrong. Please include
(or link to, if it is too verbose) the log output. -->
## What did you do to try analyzing the problem?
<!-- Describe what steps you already did to try analyzing the problem before
reporting. -->
I searched this project in GitHub looking the text "Error during diff download. Bailing out." and was unable to find where it comes from. I checked osmium-tool as well thinking it might be there and also did not find it.
--
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/issues/2206
You are receiving this because you are subscribed to this thread.
Message ID: <osm2pgsql-dev/osm2pgsql/issues/2206 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20240706/f15eacee/attachment.htm>
More information about the Tile-serving
mailing list