mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2026-07-21 07:54:15 +00:00
The dump replay ran statement-by-statement with autocommit. When restore --empty runs against a LIVE database, the pre-clean drops a table, the replay recreates it and autocommits, and a concurrent writer (discourse's mini_scheduler upserting scheduler_stats(id=1)) inserts the same primary key into the empty table before the dump's COPY loads it. The COPY then aborts with a duplicate-key violation under ON_ERROR_STOP and the whole restore fails. Running the replay with --single-transaction keeps the recreated table invisible to other sessions until commit, so the writer can never insert the racing row. The --empty pre-clean stays multi-statement (\gexec, one DROP per statement): running every DROP in one transaction exhausts max_locks_per_transaction on large schemas (e.g. gitlab). Extract the pre-clean SQL from the inline string into restore/db/empty_preclean.sql (loaded via dirname(__file__)) and declare it as package-data so it ships in the wheel. Add a unit test guarding the single-transaction/multi-statement split and an e2e that reproduces the live-writer race. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
752 B
TOML
33 lines
752 B
TOML
[build-system]
|
|
requires = ["setuptools>=69", "wheel"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "backup-docker-to-local"
|
|
version = "3.1.2"
|
|
description = "Backup Docker volumes to local with rsync and optional DB dumps."
|
|
readme = "README.md"
|
|
requires-python = ">=3.9"
|
|
license = { text = "AGPL-3.0-or-later" }
|
|
authors = [{ name = "Kevin Veen-Birkenbach" }]
|
|
|
|
dependencies = [
|
|
"pandas",
|
|
"dirval",
|
|
]
|
|
|
|
[project.scripts]
|
|
baudolo = "baudolo.backup.__main__:main"
|
|
baudolo-restore = "baudolo.restore.__main__:main"
|
|
baudolo-seed = "baudolo.seed.__main__:main"
|
|
|
|
[tool.setuptools]
|
|
package-dir = { "" = "src" }
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["src"]
|
|
exclude = ["tests*"]
|
|
|
|
[tool.setuptools.package-data]
|
|
"baudolo.restore.db" = ["*.sql"]
|