Imports of osm planet can take hours or days and a single error can take down the import process. Something like the database not existing or open makes sense, but a bad connection should result in retries.
[Jul 2 04:04:47] [PostGIS] SQL Error: driver: bad connection in query COPY "import"."osm_buildings" ...
Expected Behavior
On a sql error in the middle of the import, the query should be run again N times (command line flag?) with with an increasing delay between them, or a constant specified amount of time (command line flag?).
Actual Behavior
The process exists.
Possible Fix
The error handling mechanism should differentiate between fatal errors and retry-able errors. And implement a higher order function to take care of this.
func RetryN(n int, fn func(n int) error) error {
for i := 0; i < n; i ++ {
err := fn(i)
if err == nil {
return nil
}
log.Warnf("retry %d, %v", n, err)
}
}
It's not that easy. Import is all done in a single transaction (with a COPY FROM data stream). If the connection is dropped, the transaction is lost and Imposm can't continue with the import.
Context
Imports of osm planet can take hours or days and a single error can take down the import process. Something like the database not existing or open makes sense, but a bad connection should result in retries.
Expected Behavior
On a sql error in the middle of the import, the query should be run again N times (command line flag?) with with an increasing delay between them, or a constant specified amount of time (command line flag?).
Actual Behavior
The process exists.
Possible Fix
The error handling mechanism should differentiate between fatal errors and retry-able errors. And implement a higher order function to take care of this.
using this function might be
Context
It requires re-import.
Your Environment