The write path in Infino is a single-writer, multi-phase pipeline managed by the SupertableWriter. It coordinates the transition of data from in-memory buffers to immutable, content-addressed superfiles and finally publishes them via an atomic visibility barrier in the manifest.
The SupertableWriter is a long-lived handle acquired via Supertable::writer(). Infino enforces a single-writer model per supertable using an internal writer_outstanding flag src/supertable/writer.rs14-17
The lifecycle follows an append*N -> commit pattern:
BufferedBatch payloads src/supertable/writer.rs132-137commit(), the buffer is partitioned into row-balanced shards src/supertable/writer.rs31-33SuperfileBuilder on a Rayon worker pool src/supertable/writer.rs11-13This diagram illustrates the association between high-level write stages and the code entities responsible for them.
Sources: src/supertable/writer.rs6-37 src/supertable/manifest/commit.rs23-43 tests/supertable/commit/persistence.rs9-13
When append() is called, Infino performs schema and null validation via split_vectors src/supertable/writer.rs27-30 It clones the underlying Float32Array payloads (using Arc to avoid copying bytes) into a BufferedBatch to keep buffer ownership clean across append calls src/supertable/writer.rs40-48
The writer tracks an estimated byte cost (buffer_bytes). If this exceeds a configured threshold, an internal commit() is triggered automatically src/supertable/writer.rs138-140 During commit(), the fanout_shards utility partitions the data across the writer pool's rayon workers src/supertable/writer.rs19-21
During the write path, Infino auto-injects a 128-bit Snowflake-style ID into the _id column using IdGenerator src/supertable/utils/idgen.rs4-21
i128 comparison matches time order for efficient manifest pruning src/supertable/utils/idgen.rs17-21Sources: src/supertable/writer.rs131-140 src/supertable/utils/vector_split.rs48-58 src/supertable/utils/idgen.rs4-73
Each shard is consumed by a SuperfileBuilder, which produces a single Parquet-compatible superfile containing columnar data, FTS blobs, and vector regions src/supertable/writer.rs20-22
Infino selects an upload strategy based on the file size:
put_atomic (or put_if_match) to write the entire file in one RTT src/supertable/manifest/commit.rs12-14put_multipart src/supertable/writer.rs67 This is verified via tests that force every upload through the multipart path by setting a 1-byte threshold tests/supertable/commit/persistence.rs157-164Sources: src/supertable/writer.rs20-22 src/supertable/manifest/commit.rs12-19 tests/supertable/commit/persistence.rs157-164
Infino uses Optimistic Concurrency Control (OCC) to manage manifest updates. The commit process is orchestrated by commit_manifest src/supertable/manifest/commit.rs23-37
The pipeline issues multiple I/O requests in parallel to minimize RTTs:
_supertable/current) src/supertable/manifest/commit.rs32-36If the pointer update fails due to a version mismatch (another writer committed first), the storage layer returns a PreconditionFailed error. The commit path captures this as CommitError::WriteContentionExhausted, triggering a jittered backoff before retrying the commit against the new manifest head tests/supertable/commit/pointer_atomic.rs13-15
The following diagram maps the sequence of function calls and storage interactions during a commit.
Sources: src/supertable/manifest/commit.rs23-43 src/supertable/writer.rs19-37 tests/supertable/commit/pointer_atomic.rs13-25
Updates and deletes follow the same "buffer then commit" pattern but involve the Write-Ahead Log (WAL) for durability src/supertable/writer.rs141-150
update() or delete() resolves the predicate against the current snapshot to find matching target_ids src/supertable/writer.rs157-172commit() call drives these entries through the WAL pipeline stages (Append Phase, Tombstone Phase) src/supertable/writer.rs86-93Sources: src/supertable/writer.rs141-172 src/supertable/wal/state_doc.rs89-92
The pointer file located at _supertable/current is the single source of truth for the supertable's state src/supertable/manifest/commit.rs68 It contains:
manifest_id: Monotonically increasing version number.manifest_uri: Path to the JSON manifest list.content_hash: Blake3 hash of the manifest list src/supertable/manifest/commit.rs97-101Because the pointer update is the final step and is performed using an atomic rename or conditional PUT, any crash before this point results in an "orphan" superfile or manifest part that is ignored by readers and eventually cleaned up by Garbage Collection tests/supertable_commit_crash_localfs.rs19-30
Sources: src/supertable/manifest/commit.rs68-101 tests/supertable_commit_crash_localfs.rs4-36
Refresh this wiki