FrankenGraphDB

Strata: The Storage Engine (Bet B2)

2,008 words7 subsections1 listingA design document: it describes the 1.0 target, not what runs today.

On this page7
6.1 Topology of the store6.2 Tier D internals6.3 Tier R internals (sealed runs)6.4 Property storage6.5 Vertex directory6.6 Write amplification & space discipline6.7 Buffer & memory management

Strata resolves the write/scan/space trilemma by refusing to pick one point on it. Authoritative incidence is partitioned by stable vertex identity and edge type, never by mutable labels. Each (vertex, direction, edge_type) adjacency exists across three tiers, migrating by temperature.

6.1 Topology of the store

                       VERTEX DIRECTORY (per stable partition)
       snapshot ordinal → { stable VId, label-set ref, prop locator, sparse descriptor-table ref }
       packed ordinal maps + membership indexes; canonical constraint map for external keys
                                        │
        ┌───────────────────────────────┼─────────────────────────────────────┐
        ▼                               ▼                                     ▼
  TIER D: DELTA (immutable published  TIER R: SEALED RUNS (immutable)   TIER A: CHECKPOINTS (ECS, cold)
  versions; mutable staging only)
  sorted 256-edge blocks              per-(partition,type,dir) runs     full compressed partition
  per-block MVCC version chains       per-list codec tags +             snapshots + logical effects
  hub vertices: skip-list of blocks   delta-varint neighbor gaps        (time travel / restore /
  hot-burst overflow log (bounded)    stable-EId-keyed property         replica seeding)
  volatile latch-free staging,        chunks; zone maps;
  immutable roots at publication      optional per-run bitmap ("holes")
        │            ▲                          ▲
        └─ seal ─────┘── compact (k-way merge, generational) ──┘
  • Tier I (inline micro-adjacency): below the diagram's three tiers sits a zeroth one. A small bounded vector in the vertex row stores the first few active (direction, edge_type, descriptor) entries; the descriptor may inline up to eight (dst_VId, EId, prop_locator) incidences. Mutable tiers never store a bare snapshot ordinal. Additional edge types live in a sparse immutable descriptor table, so schema cardinality cannot bloat every row. Overflow promotes to Tier D; demotion is a verified representation transition.
  • A logical adjacency list = merge(inline slot, delta blocks, [newest…oldest] sealed runs), exactly an LSM, except runs are graph-shaped and sorted by (src_snapshot_ordinal, dst_snapshot_ordinal, EId). Tombstones and run holes carry creation/retirement marker references or a lineage-pinned effective-interval sidecar; a branch-agnostic scalar retire sequence or current hole bitmap may never hide an edge from a sibling branch or older snapshot. Compression-ratio numbers are benchmark results tied to named corpora and encodings, not universal facts.
  • Direction: canonical forward runs always; reverse runs are declared synchronously maintained materializations enabled by default and may be disabled per edge type only with the registered reverse-scan fallback. Every present/required reverse family must equal the transpose of authorized forward incidence at each snapshot; disabling it changes performance, never semantics.
  • Partitioning: runs are segmented by stable source partition and snapshot-ordinal ranges—the unit of compaction, buffering, statistics, checksums, and parallel scans. Labels use separate membership bitmaps and derived Beacon projections. Source-range ownership is an edge-cut/vertex-owner layout; a future hub-splitting vertex-cut mode is a different protocol and is named separately in §14.6.

6.2 Tier D internals

  1. Sorted edge blocks (Sortledton lesson): the durable unit is immutable DeltaBlockVersion {format,partition_id,descriptor_key,stripe_range,sorted_entries[],visibility_intervals[],property_patch_refs[],predecessor:ConditionalCoordinateRef<DeltaBlockVersion>?,canonical_logical_digest}. A block is about 4 KiB and holds at most 256 (dst_VId,EId,user_key_ref?,prop_row_ref,flags) entries sorted by stable identity. Canonical stable-key encoding is defined normatively for identity columns (dst_VId, EId): a registered order-preserving shared-prefix layout in which a block-header dictionary carries the allocation_epoch+partition_id components and the monotone_slot suffix is fixed-width or delta/FOR-coded; the layouts are registered as codecs in the run/block codec tables and, like every codec choice, are covered by the logical-digest validator over stable IDs, so encodings evolve without a format-identity change. Binary search and SIMD lower-bound operate on the fixed-width suffix under the header-extracted prefix, which preserves canonical big-endian epoch‖partition‖slot order exactly. Reverse-family blocks — destination-grouped, carrying source-partition EIds — may require multi-entry dictionaries and degrade gracefully toward raw width under adversarial prefix diversity. The stated block sizing — about 4 KiB, at most 256 entries — presumes this encoding (≤16 B per entry); raw 128-bit identities would cap a 4 KiB block near 95 entries. DeltaPartitionRoot {partition_id,generation,descriptor_map_ref,sorted_block_head_refs[],overflow_state:Empty|Drained{through_commit_seq},canonical_partition_digest} and immutable skip-list nodes represent a vertex's zero, one, or hub-sized two-level block family. Every reference is typed and every published root is content-addressed.
  2. Per-block MVCC: a published block head reaches an immutable predecessor chain; no durable bump-arena index or process pointer appears in canonical bytes. Readers continue down the chain until the first version satisfying all sequence, branch-ancestry, schema, retirement, and own-write visibility predicates; a newer sibling-branch version is skipped rather than terminating the search. The current-line fast path may collapse this to one compare only under a verified lineage token. Process-local VersionArena/prev_idx layouts are discardable decoded caches for those immutable objects, never the authoritative chain.
  3. Concurrency, staging, and visibility: eager block locks, latch-free transaction-private nodes, bump arenas, and EBR are strictly volatile staging machinery. A writer may build a candidate from those nodes, but before any logical state/root/RootSlot can name the result it must canonicalize and seal complete DeltaBlockVersion and DeltaPartitionRoot objects, verify their logical digest against the committed effects/marker, and root the immutable partition generation atomically with the candidate state. Publication never stamps or mutates an old object or authoritative pointer. Abort drops only volatile staging; crash recovery discards every unrooted arena/overflow node and deterministically reconstructs from the Chronicle command/effect suffix. Readers merge committed immutable roots plus their own private overlay; another transaction's staging is unobservable. Giant hubs stripe the neighbor-ID space into independently locked/versioned candidate ranges, and witness granularity follows the durable stripe identity.
  4. Hot-burst overflow: a bounded per-partition append log may absorb spikes only as volatile, transaction-tagged staging. The drain actor preserves commit order and verifies the canonical logical digest while producing immutable blocks; the same root-publication barrier applies. The log is neither a durable source of truth nor recoverable state, and admission backpressures before memory is exhausted. A future durable overflow representation would require a separately registered immutable object and state transition; none exists in v1.
  5. Property deltas live beside adjacency deltas as row-patches; sealed property data is columnar (§6.4).

6.3 Tier R internals (sealed runs)

  • Layout per run segment: header (fenceposts, stats, checksum, seq-range, source_ordinal_map_id, destination_map_table[]) · Elias–Fano offsets for O(1) list location · per-list NeighborCodec chosen from EliasFano, StreamVByte { skip_table }, or DenseIntervals · stable EIds/OriginBirthOrders and replaceable property locators · versioned marker-aware hole/retire metadata. A source ordinal is meaningful only under the source map. Each encoded destination is either stable VId or (destination_map_slot, dst_ordinal), where the slot names an explicit { destination_partition, OrdinalMapId }; no ordinal crosses a map boundary untagged. Codec/map choice is covered by the logical-digest validator over stable IDs. The stable_eids and OriginBirthOrder columns are identity columns under §6.2's canonical stable-key encoding law — delta/FOR-encoded against the run-header prefix dictionary — and a sorted sealed run compresses the EId column to a few bytes per entry.
  • Compressed intersections with an honest contract: Elias–Fano neighbor lists support rank/select directly. StreamVByte lists use skip/fence metadata and bounded blockwise decode; dense intervals use interval arithmetic. Loom intersects without full-list decompression where the codec permits it—there is no claim that Elias–Fano offsets provide rank/select over a separate varint stream.
  • Runs are generational: seal (Tier D → R₀ run), then merge R₀…R_k per partition. A snapshot pins run generations via epochs; compaction publishes a new segment set atomically in the manifest and retires the old under lease — readers never block, never see mixed generations.
  • The merge policy is a governed family, not a constant: per (partition, edge_type, direction), a bounded leveled↔tiered family is evaluated in shadow and deployed as a pinned deterministic table; static size-tiering is the permanent fallback. Birth–death and stability analyses are named configuration models with sensitivity bounds, while dwell/hysteresis and measured churn are runtime guards. They do not prove universal absence of oscillation.

6.4 Property storage

Vertex property chunks are grouped by (stable partition, property/storage family), not mutable label. Label scans apply versioned membership bitmaps before reading rows. Edge chunks are grouped by (edge_type, property, run generation) and sequential by replaceable run row, with a stable EId sidecar. Published Tier-D patches are immutable objects and obey the same MVCC/branch visibility rules; mutable row-patch buffers are staging only. Embedding matrices are generation-pinned inputs to vector indexes; “zero-copy” is used only when requested dtype, alignment, authorization, and snapshot generation actually match.

6.5 Vertex directory

Per stable partition and generation, a packed array maps snapshot-local dense ordinal to { stable VId, label-set ref, property locator, small active-descriptor vector, sparse descriptor-table ref }; a reverse map resolves VId to that generation's ordinal. IDs are never recycled (§4.5). Degree is O(1) per authorized descriptor only after Warden masking; unauthorized edge types do not contribute. Directory and label-membership segments are versioned immutable objects.

6.6 Write amplification & space discipline

Write amplification is all physical bytes written / canonical logical input bytes and includes canonical forward plus any configured reverse-incidence materializations, properties, constraint and optimizer indexes, checkpoints, FEC, staging waste, and every merge level; reports publish the component breakdown. Space amplification names the logical baseline and includes key wraps, repair symbols, and retained history. Identity-column bytes per live edge, reported by tier — Tier D block entries, sealed-run stable_eids/OriginBirthOrder columns, and any configured reverse-family materialization — are a named component of both breakdowns under the registered identity-column encoding of §6.2/§6.3 and feed §17 law 4's bytes-per-live-edge metric. Numerical targets in §17 are benchmark gates, not format truths. Every representation migration emits a decision card with state, candidates, cost interval, minimum dwell, uncertainty, and pinned deterministic fallback.

Under Sextant (the calibration discipline within B5, §15.0), the card machinery adds statistical evidence without changing safety semantics:

  • Migration evidence is sequential, while dwell remains a hard guard. An SPRT may evaluate promote/demote evidence under an explicit observation model and loss matrix; its reported error rates are conditional on those assumptions. Minimum dwell and benefit-greater-than-conversion-cost-plus-uncertainty remain deterministic anti-thrash rules even when the model is invalid.
  • Policies remain on trial. An e-process may compare a policy with its pinned fallback on a declared outcome stream. Promotion evidence is FG-CAL-01; failure of assumptions or evidence reverts to the fallback through a stream-sequenced DecisionPolicyEpoch. It is not a production safety-invariant checker.
  • Counterfactual audit has a support condition. Logged selection probability permits importance-weighted or doubly robust evaluation only for candidate actions with positive logging-policy support and adequate effective sample size. A deterministic action table with zero support cannot evaluate arbitrary alternatives. Every report names overlap, clipping, estimator, sample size, and confidence assumptions (FG-EVID-01).
  • Learning never directly touches the serving path. Continuous policies learn in shadow and deploy only as versioned deterministic tables. Any regret or coverage statement stays attached to its population and assumptions; the deployed table inherits no universal guarantee by distillation alone.
  • One regime clock. All calibration windows and retune decisions key off a single changepoint detector (Bayesian online changepoint + Shiryaev–Roberts, §15.0) emitting logged regime-epoch IDs — controllers stop debouncing independently, and "policy changed because regime 47 began" becomes a replayable causal statement.

6.7 Buffer & memory management

  • Extent-based buffer manager over variable-size segments (Umbra lesson): segment handles are swizzlable — hot segments pin to direct pointers; cold segments fault through the manager. Reads use optimistic epoch-protected access (asupersync EBR): version-stamped, retry-on-conflict, no reader latches (LeanStore OLC discipline).
  • Admission/eviction: ARC and an S3-FIFO-style design share one policy trait and may be ghost-evaluated in shadow. A snapshot protects object generations from GC; only an active BufferHandle pins a frame in RAM. Frames needed later by the same snapshot may be evicted and faulted back. Ghost metadata is cleaned when object generations become unreachable, and scans use admission bypass/resistance.
  • I/O: io_uring via asupersync fs; O_DIRECT with page-aligned buffers; readahead planned by the executor (runs declare their scan intent, the buffer manager prefetches segment chains — B-tree-descent prefetch generalized).
  • Query memory and scratch: every query's resident scratch uses its region heap. Spill uses a separate ScratchStore: region-scoped, non-authoritative, non-fsynced, not RaptorQ-coded, outside the database manifest, and keyed by a startup-cleanable generation. Region close unlinks only its own proven scratch objects. Admission bounds all database-accounted allocations and preserves an emergency reserve; allocation failure or an operator whose minimum resident set cannot fit returns structured ResourceExhausted with no partial success unless the query explicitly requested truncation. The plan does not claim immunity from host overcommit, allocator failure, or unaccounted foundation defects.
  • NUMA: partition→socket affinity for pinned segments; morsel scheduler prefers local partitions.