feat: add temp-file swap to BigQuery extractor

Write to extract.duckdb.tmp, then atomically swap into place with WAL cleanup.
Prevents lock conflicts with orchestrator holding read lock on existing database.
This commit is contained in:
ZdenekSrotyr 2026-04-09 07:00:19 +02:00
parent f25393871d
commit 1488e01bf9

View file

@ -112,6 +112,18 @@ def init_extract(
finally:
conn.close()
# Atomic swap with WAL cleanup
old_wal = Path(str(db_path) + ".wal")
if old_wal.exists():
old_wal.unlink()
if tmp_db_path.exists():
shutil.move(str(tmp_db_path), str(db_path))
tmp_wal = Path(str(tmp_db_path) + ".wal")
if tmp_wal.exists():
tmp_wal.unlink()
return stats