osm2pgsql-dev / osm2pgsql

OpenStreetMap data to PostgreSQL converter
https://osm2pgsql.org
GNU General Public License v2.0
1.5k stars 474 forks source link

Resuming failed imports/updates #1751

Open joto opened 2 years ago

joto commented 2 years ago

Imports with osm2pgsql can take quite some time and if something breaks you have to start from scratch. Some kind of "resume" feature is requested often and we should look into what's needed for that, but it will not be easy to support that.

There are several reasons why an import can fail:

A resuming function will need these things:

And we'll need to have solutions for all the details:

pnorman commented 2 years ago

For processing, it seems we would need to move to importing in-transaction, then committing ever N objects, including updating the state in some in-db table. This would rule out parallel connections.

The low-hanging fruit here is crashes in the table optimizing state. If we make it so the earlier phase import into table_temp named tables, then we can re-run the SQL commands safely.