Skip to content

fix(artifact): snapshot exports consistently and refuse corrupt imports#1019

Merged
DeusData merged 1 commit into
mainfrom
fix/artifact-torn-export
Jul 11, 2026
Merged

fix(artifact): snapshot exports consistently and refuse corrupt imports#1019
DeusData merged 1 commit into
mainfrom
fix/artifact-torn-export

Conversation

@DeusData

Copy link
Copy Markdown
Owner

Closes #895.

Export half: CBM_ARTIFACT_FAST (the watcher/incremental auto-update path) raw-copied the main file of a live WAL-mode store — committed rows still in the -wal were simply absent, and mid-checkpoint reads were torn (matching the field artifact's quick_check output in the report). Both quality levels now snapshot via VACUUM INTO; only index-stripping stays BEST-only, FAST keeps zstd-3 — exactly the remedy the report proposed. Perf note: the fast path now pays a full-copy VACUUM INTO per export; correctness first — a torn team-shared artifact costs far more than the copy.

Import half: new cbm_store_check_integrity_deep (shallow + PRAGMA quick_check(1)) used at import only — the three hot-path callers of the shallow check are untouched (quick_check is O(db) and doesn't belong on store-resolution/open paths).

Reproduce-first:

  • artifact_fast_export_snapshots_live_wal_store: export while the writer connection is open → RED on old code with 0 of 60 nodes surviving the round-trip; GREEN now.
  • store_deep_integrity_detects_page_corruption: healthy file passes, zero-banded pages refused — both directions pinned.

Full suite 5,991/0, lint-ci clean. Thanks @kriswill — third precise store-integrity report in this series (#896, #897), all three now fixed.

@DeusData DeusData added this to the 0.9.1-rc milestone Jul 11, 2026
@DeusData DeusData enabled auto-merge July 11, 2026 01:28
The FAST export path (the watcher/incremental auto-update) read the
raw main-file bytes of a live WAL-mode store: committed rows still in
the -wal were missing entirely and mid-checkpoint reads produced torn
snapshots (field artifact: four short indexes + btreeInitPage error 11
across ~12 nodes-table pages). Import then installed the torn file
byte-for-byte — the integrity check only sanity-checked the projects
table.

- Export: both quality levels now snapshot via VACUUM INTO (the
  consistent copy); only the index-stripping remains BEST-only, FAST
  keeps zstd-3. The fast path pays a full-copy VACUUM INTO now —
  correctness over speed; a torn team-shared artifact costs far more.
- Import: new cbm_store_check_integrity_deep (shallow check + PRAGMA
  quick_check) — used only on this rare path, hot-path callers keep
  the cheap shallow check.

Reproduce-first: artifact_fast_export_snapshots_live_wal_store
exports FAST while the writer connection is open — RED on the old
code with 0 of 60 nodes surviving the round-trip (all rows lived in
the WAL); GREEN now. store_deep_integrity_detects_page_corruption
pins the import guard both directions (healthy passes, zero-banded
pages refused).

Closes #895

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData DeusData merged commit d7e6082 into main Jul 11, 2026
21 checks passed
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.

Fast artifact export raw-copies a live WAL-mode DB — torn graph.db.zst that import then installs unchecked

1 participant