Skip to content

Confluence import: store layer and CAS transitions - #33

Draft
Willyfrog wants to merge 1 commit into
stack/2-importerfrom
stack/3-store
Draft

Confluence import: store layer and CAS transitions#33
Willyfrog wants to merge 1 commit into
stack/2-importerfrom
stack/3-store

Conversation

@Willyfrog

@Willyfrog Willyfrog commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Layer 4 of 7 in the Confluence page import stack, split out of #18. The design narrative and the accepted risks live in #18 — read it first; this PR is one layer of it.

Stack order: #30#31#32#33#34#35#36

The persistence layer, and where the concurrency design actually lives. Every state transition is a compare-and-set against the state the selection read, so a stale read loses its CAS rather than duplicating work — there are no leases and no heartbeats by design.

What's here

import_store.go, import_page_store.go, import_preflight_store.go, import_terminal_store.go, import_report_store.go.

What to look for

  • Is every transition genuinely a CAS? A read-then-write that isn't conditioned on the state that was read is the bug class this design exists to prevent. Look for any UPDATE whose WHERE omits the expected prior state.
  • Serialization by selection, not by ordering — a job that may have written pages fences its source and Space until it terminalizes. Check the fence is taken before the first write, not after.
  • Progress is reconstructed from immutable per-page checkpoints, never remembered. Confirm nothing caches progress in a way a crash could resurrect stale.
  • Report streaming — rows come from several queries, so a plan republished mid-download must be detected and declared rather than producing a valid-looking hybrid.
  • NUL bytes in content — persistence path was fixed once already; check it holds.

Verification

go build ./..., go vet ./... clean. server/store suite green.

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