Skip to content

Resume interrupted imports instead of DROP DATABASE on restart#661

Open
zebernst wants to merge 3 commits into
mediagis:masterfrom
zebernst:feat/resume-interrupted-import
Open

Resume interrupted imports instead of DROP DATABASE on restart#661
zebernst wants to merge 3 commits into
mediagis:masterfrom
zebernst:feat/resume-interrupted-import

Conversation

@zebernst

@zebernst zebernst commented Jul 20, 2026

Copy link
Copy Markdown

Summary

  • On restart without import-finished, detect the Nominatim import stage from Postgres and continue or skip instead of always DROP DATABASE (#660).
  • Fail closed when resume would be destructive or ambiguous (probe errors, flatnode/fresh mismatch, mid-osm2pgsql, postcodes/pre-index without a safe continue target).
  • Keep Tiger address data recoverable on the done path: still import if the archive is present and Tiger rows are missing; only delete the archive after Tiger is loaded.
  • CI covers marker-loss (done) and a deterministic --continue db-postprocess path; assert helper retries until the API is up.

Motivation

With a persistent /var/lib/postgresql/16/main volume, any container restart before import-finished previously wiped osm2pgsql/indexing progress. Related: #342, #350, #332.

Behavior

Detected stage Action
fresh DROP + full import (refuse if flatnode is non-empty)
load-data nominatim import --continue load-data (empty placex only)
indexing / db-postprocess nominatim import --continue <stage>
done Skip import; still apply Tiger if archive present and unloaded
Probe / flatnode / mid-osm2pgsql / ambiguous pre-index Exit non-zero; never DROP

Operators restart the same container with the same volumes — no special resume CMD.

Test plan

  • CI: existing matrix stays green
  • CI: "Resume when import-finished marker is missing" → Detected import stage: done, no DROP DATABASE, search works
  • CI: "Resume interrupted import with volume" → Detected import stage: db-postprocess and --continue db-postprocess, no DROP DATABASE, search works
  • Local: rebuilt nominatim:5.3.2; marker-loss done-path and db-postprocess continue both passed against Monaco

Made with Cursor

Zach Bernstein and others added 3 commits July 20, 2026 18:48
Detect Nominatim import stage in init.sh and continue via
nominatim import --continue when a persistent Postgres volume has
partial progress. Fail closed on probe errors and flatnode/DB
inconsistency. Document the restart behavior and cover marker-lost
and mid-import resume in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid mapping the postcodes/early-index window to --continue load-data
(Nominatim truncates placex), keep Tiger archives until loaded, and make
CI prove a real --continue path without Mac port / pipefail false fails.

Co-authored-by: Cursor <cursoragent@cursor.com>
The helper was a thin wrapper around a single nominatim import --continue
call; keep detect-and-act in one place.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant