Repository navigation
[fence 1/9] libsql-server: document the namespace fence contract - #41
tszymczyszyn-shopify wants to merge 3 commits into
Conversation
Add docs/NAMESPACE_FENCE.md, the contract and design for a durable, operation-owned namespace fence: source and target state machines and permission matrix, admin API, stable outcome codes and their mapping to HTTP, Hrana, gRPC, the write proxy and replication, metastore schema and CAS semantics, write admission generations and positive drain, read fence, quarantined target lifecycle and the reusable import capability, restart and eviction rules, fail-closed metastore recovery, deployment flag and legacy-binary protection, code-path coverage, test strategy and the acceptance-test map. Co-authored-by: Tomasz Szymczyszyn <tomasz.szymczyszyn@shopify.com>
The import capability now loads dumps through namespace::dump_import (the buffered importer by default, the memory-bounded streaming importer on request) rather than a separate copy of the loader.
eef1521 to
d239d38
Compare
|
Rebased the fence stack (#41–#49) onto #53 ( How the conflicts were resolved:
New commits (everything else is the original commits replayed):
Local verification (macOS): |
The section 3.3 matrix omitted operations section 3.2 and transition.rs allow: abort from TARGET_IMPORT_DRAINING, TARGET_VALIDATING and TARGET_WRITE_FENCED, status and the seal drain in TARGET_IMPORT_DRAINING, recording validation and publishing in TARGET_VALIDATING, and adoption. Section 13.5 stated the lock order per namespace only; add the rule for fork, the one operation that holds two namespaces' locks, and why reversed forks cannot wait for each other. Add section 9.1, the fast path that counts unfenced SQL reads instead of registering a lease. Say that the acceptance tests are spread across the stack.
|
Closing. This stack is parked; the note at the top of the description explains why. The branch is kept at |
Adds
docs/NAMESPACE_FENCE.md, the contract for the operation-owned namespace fence: state model and permission matrix, admin API, durable state, outcome codes and their mapping per protocol, write admission and positive drain, source read fence, target lifecycle, restart and failure semantics, deployment and compatibility, and observability.It started as the final version of the document from the source PR, landed first so the design can be reviewed before any code; two follow-up commits bring it up to date with the rebase onto #53 and with review. The code pieces that follow implement it; none of them edits the document.
Review focus
The state model (section 3), the outcome codes (section 6), and the deployment/compatibility rules (section 13). Agreeing on these first makes the rest of the stack a check against the contract.
Since the first version: the import API names the shared dump importers (rebase onto #53), and from review the section 3.3 matrix now matches section 3.2 and
transition.rs, section 13.5 states the cross-namespace lock order forfork, section 9.1 describes the unfenced SQL read fast path, and section 17 no longer claims every test is in one change.Commits
Stack
Part 1 of 9, based on
tszymczyszyn/atomic-namespace-create. The stack sits on #53 (tszymczyszyn/atomic-namespace-create), which sits on #51: review and land #51 → #53 → #41 → … → #49 bottom-up, restacking after each squash or rebase merge.The first version of these PRs carried #35's fence diff unchanged on
v0.9.30-shopify-patches. On 2026-10-13 the stack was rebased onto #53 (how the conflicts were resolved is summarised in a comment on #41) and gained the commits marked above.