Skip to content

Commit 28defca

Browse files
docs: component and before/after diagrams for atomic namespace creation
Exported from the Drawr board (https://drawr.quick.shopify.io/b/GNUB8o_56hhfFGxv) and embedded in the design doc.
1 parent 626e079 commit 28defca

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎docs/ATOMIC_NAMESPACE_CREATE_DESIGN.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Stacked on `tszymczyszyn/streaming-dump-importer` (PR #51). Fixes the pre-existi
66

77
## 1. Problem
88

9+
![Before and after](images/atomic-namespace-create-before-after.png)
10+
911

1012
`NamespaceStore::create` persists the namespace config **first** and only then runs the configurator's `setup` (directory, logger, connections, dump import). Three resources are mutated without a common commit point:
1113

@@ -30,6 +32,10 @@ Non-goals: a server-side import timeout; idempotency keys / async create jobs; b
3032

3133
## 3. Design in one paragraph
3234

35+
![Components and ownership](images/atomic-namespace-create-components.png)
36+
37+
*Who owns what: numbered arrows are the happy path, dashed red the undo. The second diagram (§1) contrasts the old and new sequence.*
38+
3339

3440
Make the **metastore write the commit point** and make everything before it reversible. `create` reserves the name by write-locking its cache entry, puts the config in the metastore's *in-memory* map only (so `setup` can read it), runs `setup`, and only on success **flushes the row** and installs the namespace. A `Reservation` drop guard undoes the in-memory config if the future ends any other way — error *or* cancellation — and releases the lock only after that, so waiters never observe a half-built namespace. The filesystem gets the same treatment one layer down: `setup` wraps a brand-new directory in a `FreshDir` guard that removes it on drop. For crashes, a brand-new directory carries an `.incomplete` marker until the row is flushed; the next `create` of that name discards a marked directory.
3541

120 KB
Loading
192 KB
Loading

0 commit comments

Comments
 (0)