Expand description
ColumnChunk: differential’s Chunk over Column-shaped updates.
A chunk is a sorted, consolidated run of (D, T, R) updates in the flat
columnar layout, in one of two homes:
- Resident: an
Rc-sharedColumnon the heap. Fresh input, merge output, and small tails live here. - Spilled: the serialized body in the process
Pool, with the record count and the first and last data items resident. The pool owns residency from there, with slots under a memory budget and compression and device pageout under pressure, and a body that dies before pressure reaches it is freed without I/O.
Reads of a spilled body are copy-out and scoped to the call that needs
them, the contract that lets the pool evict with no reader accounting
(see mz_ore::pool).
Spilling happens in Chunk::settle, the trait’s designated commit point:
chunks moved to settled output are handed to the pool when spilling is
enabled (see set_compute_spill_enabled and set_storage_spill_enabled
for how the per-commit destination resolves). Grading is by serialized
bytes, the ship size Column already targets, rather than by the
record-count TARGET, since record count does not bound bytes for
variable-width data.
Chunks whose data is a (key, val) pair additionally implement
UnloadChunk, the bulk-read capability: sorted probe keys in, matching
updates appended to caller-owned staging, with locate answered from the
resident fence metadata so a probe set faults only the chunk bodies it
actually touches.
Structs§
- Chunk
Chunker - A chunker for
arrange_coreoverColumnChunks: sorts and consolidates raw input columns through aColumnChunkerand wraps its output chunks. - Lz4Codec
- The chunk-side
ExtentCodec: a little-endianu32body-length prefix followed by one lz4 block, the framinglz4_flex::block::compress_prepend_sizeproduces. Every chunk consumer passesLZ4_CODECat insert; the pool itself has no codec opinion. - Spilled
Body - A spilled chunk body: the serialized column in the pool, plus the resident
metadata every
Chunkmust answer without fetching. That metadata is the record count, the first and last data items (the fence entriesUnloadChunk::locateconsults), and the time boundsextractconsults to pass frontier-disjoint chunks through without loading them. - Unchunk
Builder - A batch builder over
ColumnChunkinput that delegates to a builder overColumninput, loading each chunk’s body as it is pushed.
Enums§
- Column
Chunk - A sorted, consolidated run of
(D, T, R)updates, resident or spilled.
Constants§
- COMMIT_
BYTES 🔒 - The serialized-byte size committed chunks aim for, matching the ship size of the columnar merge machinery.
- DEFAULT_
COMPRESS_ 🔒MIN_ DEPTH - The default compression depth floor: fresh (depth 0) bodies spill uncompressed.
- READ_
SCRATCH 🔒 - Reusable staging for call-scoped reads of spilled bodies.
- SCRATCH_
RETAIN_ 🔒WORDS - Scratch capacity retained across reads, in words. A read larger than this releases the buffer afterward, so a thread’s scratch does not ratchet to the largest body it ever carried (heap no pool gauge can see).
- SPILL_
MIN_ 🔒BYTES - Bodies smaller than this stay resident: the pool’s smallest size class is 64 KiB, so spilling below it trades no meaningful memory for slot waste.
- SPILL_
OVERRIDE 🔒 - A thread-scoped pool override, taking precedence over the global enable flag and pool. Lets tests and benches spill through a private pool without touching process-global state.
Statics§
- COMPRESS_
MIN_ 🔒DEPTH - The youngest generational depth whose spilled bodies are compressed. See
set_compress_min_depth. - COMPUTE_
SPILL_ 🔒ENABLED - Compute’s leg of the process spill gate. See
set_compute_spill_enabled. - LZ4_
CODEC - The
Lz4Codecinstance chunk consumers pass toPool::insert_with. - STORAGE_
SPILL_ 🔒ENABLED - Storage’s leg of the process spill gate. See
set_storage_spill_enabled.
Functions§
- at_
commit_ 🔒size - Whether a column is big enough to commit on its own. A monotone threshold, so settle’s carry, which grows by whole chunks, cannot step over it.
- borrow_
words 🔒 - Reconstructs the borrowed columnar view from serialized words, the same
zero-copy decode
Column::borrowperforms on itsAlignvariant. - codec_
for_ 🔒depth - The codec a body at
depthstores under, identity below the compression floor and lz4 at and past it, paired with whether that codec compresses. One read of the floor, so the pair cannot disagree with itself when the floor moves under a concurrent commit. - compress_
min_ 🔒depth - The depth floor in effect for this thread’s commits.
- copy_
column 🔒 - Copy a column into a fresh
Typedcolumn via bulk per-leaf extension. - extract_
view_ 🔒into - Append every update in
viewwhose key matches a probe at or after*probe_indexintostaging, per theUnloadChunkconsume-index protocol: probes strictly below the view’s last key are consumed, a probe equal to it is extracted but left for the next chunk. - rr 🔒
- Narrow a columnar ref to a shorter lifetime, so refs from different borrows, such as a probe column and a chunk’s own columns, can be compared (the refs are lifetime-invariant).
- set_
compress_ min_ depth - Set the youngest generational depth whose spilled bodies are compressed.
- set_
compute_ spill_ enabled - Enable or disable chunk spilling on behalf of compute’s arrangement batchers.
- set_
spill_ override - Set or unset the pool through which this thread’s chunk spills are
routed, taking precedence over the gates and the process pool.
Nonerestores the global resolution. - set_
storage_ spill_ enabled - Enable or disable chunk spilling on behalf of storage’s upsert dataflows.
- spill_
column 🔒 - Serialize a column into a pool slot. The
Alignvariant is already the serialized form and copies in directly. Other variants write theirContainerBytesencoding through a cursor over the slot memory. Sizing is exact, so a short or overlong write is a contract violation and panics. - spill_
pool 🔒 - The pool committed chunks spill to, if any.
- to_
typed 🔒 - A column is
Typed, or becomes one by copy. Merge and settle accumulate intoTypedtargets. Serialized variants arrive from spill reads and remote channels. - with_
scratch 🔒 - Run
fwith this thread’s read scratch, cleared of any previous use.