Skip to content

Chunk-store version 13: the deferred format work - #6356

Draft
timsehn wants to merge 17 commits into
masterfrom
v13
Draft

timsehn wants to merge 17 commits into
masterfrom
v13

Conversation

@timsehn

@timsehn timsehn commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Draft, not for merge. A long-lived branch that collects everything deferred to the next storage format (#3057) so the cost of the switch can be judged against a working build. Version 12 stays the shipping format on master.

CI: 53 jobs pass. Three cannot go green while this is an unreleased format change, and the CI Gate fails with them:

  • compat: "format signature changed inside minor series 0.51 — bump the minor version". The series comes from git describe, so this clears when the change ships under a 0.52 tag.
  • benchmark / version-control and the relative performance gate: the baseline (master) and the candidate share fixture files, and neither build reads the other's format.

What CI found on the way there, all fixed:

  • dolt_push() with no branch crashed on a stock SQLite file.
  • Two amalgamation variants did not build: the upstream setter lived in the remote SQL file, which the external-remotes amalgamation omits, and a fallback doltlite_commit_signer stub was defined twice when chunk sources are disabled.
  • A pushed refs record could carry upstream settings; the scoped validator now refuses any change to them.
  • Tests and tools that hardcode the 168-byte manifest or the refs layout.
  • Three tests copied hand-made v12 database files. Two now build their fixtures at test time (test/lib/drop_chunk.py, and the SQL recipe for the empty-name table). doltlite_unborn_branch.test is removed: it covered a branch with an all-zero head, which only pre-fix v12 files contain.
  • Five inherited testfixture cases changed result because byte offsets moved (corrupt-4.2, index5-1.3, quota-3.2.7 to 3.2.9, quota-5.3.prep; quota-3.2.2 now passes). They are gated as intentional beside their siblings; the ratchet is five higher than master's.

Seen and not changed: a garbage-collected file whose working-set chunk is missing fails to open with SQLITE_NOTFOUND, not a corruption error. Master does the same.

Done

To do

Decisions made here that want a second opinion

  • -S is a flag only; the key comes from user.signingkey. Dolt also accepts -S<keyid>.
  • dolt_signature(ref) is a DoltLite-only name. Dolt shows signatures through dolt_log('--show-signature').
  • Upstreams of a removed remote are dropped with it, as git does.
  • The store id is random, so two files with the same content differ in 16 header bytes.

Not format work but labelled deferred, to pick up here if wanted: #5165, #5065.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Gate: success · CI run

Engine counters: success

Performance hotspots

PR-base gates: 1.25× per workload and 1.15× per section/suite, with a 10 ms minimum regression and confirmation across three attempts. Stock ratios expose standing gaps and are reported separately.

Retained workloads report fixed batches; xN in a workload name is the number of repetitions.

A workload marked ×N times N repetitions as one batch, each after the same untimed warm-up, so small workloads clear the 10 ms floor; its ms are the batch total.

Add Column With Default

#3233: deferred to the storage-format upgrade.

Workload PR base ms Candidate ms Candidate/base Stock ms Candidate/stock
add_column_default 115.527 115.015 1.00× 24.665 4.66×

Wide Row Trade-offs

Wide values are read from disk whenever they are fetched until they move out of band: #3325. 8,192 rows per table, 4 MiB cache (768 KiB for wide_thrash_*). *_small reads only the small columns; *_blob reads the payload. Stock is SQLite.

Workload PR base ms Candidate ms Candidate/base Stock ms Candidate/stock
wide_p4096_scan_small ×200 92.647 91.897 0.99× 148.690 0.62×
wide_p4096_point_small ×50 74.920 72.707 0.97× 80.929 0.90×
wide_p4096_point_blob ×5 93.413 94.120 1.01× 27.063 3.48×
wide_p16384_scan_blob ×3 98.661 99.332 1.01× 59.302 1.68×
wide_p16384_point_blob ×3 103.653 103.065 0.99× 37.152 2.77×
wide_p16384_update_small ×8 81.905 79.499 0.97× 142.639 0.56×
wide_p16384_index_fetch_small ×160 69.479 71.358 1.03× 46.277 1.54×
wide_thrash_p16384_index_fetch_small ×10 118.823 118.454 1.00× 5.032 23.54×

Uncached Reads

65,536 rows with 1024 B payloads, about 68 MB, under a 4 MiB cache: every chunk read is verified against its BLAKE3 content address, while SQLite reads the same pages from the OS cache (#3408). Stock is SQLite.

Workload PR base ms Candidate ms Candidate/base Stock ms Candidate/stock
uncached_scan_small 47.122 47.358 1.01× 14.537 3.26×
uncached_scan_payload 48.461 49.014 1.01× 18.948 2.59×
uncached_point_lookups 59.153 59.564 1.01× 18.695 3.19×
uncached_index_fetch 42.915 43.158 1.01× 13.183 3.27×
uncached_update 52.431 52.681 1.00× 15.086 3.49×

Primary Key Index Rewrites

Secondary index entries carry the primary key, so changing a non-integer key rewrites every index entry of the row, while SQLite's indexes point at an unchanged rowid; the no-index and integer-key cases are the controls (#3419). Fixed workloads use 65,536 rows with 256 B payloads; retained workloads use the parameters in their linked issues. Each timed statement runs in a transaction that rolls back. Stock is SQLite.

Workload PR base ms Candidate ms Candidate/base Stock ms Candidate/stock
pk_rewrite_text_no_indexes 79.487 79.273 1.00× 59.362 1.34×
pk_rewrite_text_three_indexes 256.322 256.873 1.00× 57.803 4.44×
pk_rewrite_integer_three_indexes 210.882 208.770 0.99× 150.321 1.39×

Text Key Index Fetches

Rows are clustered by their primary key and there is no rowid, so a non-covering index fetch searches the table by the key the index entry carries; a text key costs a byte-wise search where SQLite seeks an integer rowid. The integer-key case is the control (#3492). Fixed workloads use 65,536 rows with 256 B payloads; retained workloads use the parameters in their linked issues. Each timed statement runs in a transaction that rolls back. Stock is SQLite.

Workload PR base ms Candidate ms Candidate/base Stock ms Candidate/stock
key_fetch_text ×15 76.934 75.918 0.99× 40.792 1.86×
key_fetch_integer ×20 74.444 76.356 1.03× 52.494 1.45×

Pending Edit Map

Uncommitted edits live in a sorted pending map: writes pay to fill it, and reads in the transaction merge it with the tree and skip its deletes. The file-backed update and live-row probes are the controls (#3418). Fixed workloads use 65,536 rows with 256 B payloads; retained workloads use the parameters in their linked issues. Each timed statement runs in a transaction that rolls back. Stock is SQLite.

Workload PR base ms Candidate ms Candidate/base Stock ms Candidate/stock
pending_update_memory ×4 120.379 130.426 1.08× 56.565 2.31×
pending_update_payload_memory ×3 110.508 117.293 1.06× 55.549 2.11×
pending_update_file ×4 123.353 131.823 1.07× 104.057 1.27×
pending_index_probes_live ×14 80.403 76.466 0.95× 38.226 2.00×
pending_index_probes_deleted ×16 82.004 81.131 0.99× 29.742 2.73×
wide_text_update_memory_x1 424.255 423.651 1.00× 125.163 3.38×

In Transaction with Mutations

Each timed statement follows an untimed mutation in the same transaction; rollback is untimed.

Workload PR base ms Candidate ms Candidate/base Stock ms Candidate/stock
text_pk_range_after_update_x4 208.429 208.448 1.00× 43.418 4.80×

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

DoltLite performance vs PR base

FAILED: unable to generate the benchmark comparison.

Tim and others added 15 commits December 3, 2026 21:05
Commit records get a four-byte header so a chunk is classified by its magic,
millisecond timestamps so same-second commits keep their order, and a tagged
extension section so later fields do not need another format bump.

Version 12 files are refused. Tests, the corpus and migration follow.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Refs record v8 adds an upstreams section: local configuration, like remotes,
that a push never carries. Deleting a branch or a remote drops its upstreams;
renaming a branch moves it.

- dolt_push('-u' / '--set-upstream', remote, branch) records the upstream.
- dolt_push() and dolt_pull() with no branch use the current branch's upstream.
- dolt_checkout('--track' / '-t', 'remote/branch'), with or without -b.
- dolt_branch('--track', ...), '-u' / '--set-upstream-to', '--unset-upstream'.
- Clone and a checkout that creates a branch from a tracking ref set it.
- dolt_branches.remote and .branch report it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A tagged extension field holds a detached signature over the record with the
field left out; doltliteCommitSignedPayload returns those bytes. An unknown
extension a reader may not skip, or one out of order, is corrupt.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
doltlite_commit_signer registers the function that signs a commit; the library
never runs a signing program itself, so embedded and sandboxed builds stay
usable. The shell registers one that runs gpg (or DOLTLITE_GPG_PROGRAM) on
Unix. A failed or missing signer fails the commit and leaves HEAD, working
and staged data alone.

user.signingkey selects the key; dolt_signature(ref) returns what was stored.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The manifest grows to 192 bytes and carries a 16-byte store id, minted when
the file is created and written by every later manifest, including gc's.
The moved-file check accepts a branch tip as proof only from a file with our
id: two stores can hold byte-identical commits, so content alone cannot tell
a stranger at a vacated path from our own file.

pager4-1.4 no longer needs its gate. The identical-commit case needs two seed
commits in the same millisecond and has no deterministic test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
An integer no double holds is stored as its 9-byte base, a marker, and the
exact value. The marker was 0x80, below a complemented DESC tag, so such a key
sorted before shorter keys with the same base when the next column was DESC.
It is now 0xFE, above every field tag.

Version 12 kept the old bytes and worked around them: one such key marked the
whole index unordered, and every lookup on it became a scan. That machinery
(the wide-numeric memo, its planner flag and the seek guards) is removed.

doltlite_numeric_desc_compat.test read a version 12 file with the old keys
and goes with them; the migrator will cover those files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The contract test, its evidence table and the C format test now describe
version 13: commit record v3, refs record v8, and refusal of versions 12 and
14. test/format-corpus/v13 is generated by the same recipe and will be
regenerated as the remaining format work lands. The version 12 corpus stays
as input for the migrator.

The frozen version 12 file showed a dolt_rebase table on main; the current
writer does not produce one, on master either, so that expectation is 0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tool/doltlite-migrate.py rebuilds a database in the current format using two
binaries: one that reads the old file exports each commit as a row-level
patch against its first parent, and the current one replays it. No version 12
reader lives in this engine.

dolt_migrate_commit stores a commit of the working catalog with explicit
parents, author and time, so merges and the root keep their shape and the
result is a pure function of the old history: two runs give the same commit
hashes. Branches, the default branch, tags, remotes and staged and working
changes carry over; an in-progress merge or rebase, constraint violations and
remote-tracking branches are reported as not migrated. Each commit can be
verified against the original by table content, and a commit map is written
beside the new file.

test/doltlite_migrate_test.sh migrates the frozen version 12 corpus; it needs
a version 12 binary and is not yet wired into CI.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
dolt_push with no branch looked up an upstream through a chunk store a stock
SQLite file does not have. A pushed refs record that differs from the
receiver's upstreams is now rejected, forced or not.

Tests that build refs records and manifests by hand follow the new layouts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The chunk analyzers and the Rust smoke test hardcoded 168 bytes.

Six inherited cases depend on where fixed byte offsets and 1024-byte page
boundaries fall in the file, and the 24 extra manifest bytes moved them:
corrupt-4.2, index5-1.3, quota-3.2.7 to 3.2.9 and quota-5.3.prep. They are
gated as intentional beside their siblings and the ratchet counts them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Three tests copied hand-made version 12 database files that this engine
cannot open and that had no recipe.

- doltlite_missing_chunk_errors.sh now makes its two states itself:
  test/lib/drop_chunk.py renames one chunk where the store names it.
- doltlite_empty_table_update.test builds its fixture from the SQL recipe
  that was already beside it.
- doltlite_unborn_branch.test is removed with its fixture. It covered a
  branch with an all-zero head, which only databases written before the
  push-default fix contain; no version 13 file can be in that state. The
  migrator reports such a branch as not migrated.

remote_test.sh: a clone now records its upstream, so a bare pull with two
remotes follows it; the old expectation holds once the upstream is unset.
quota-3.2.2 passes with the new layout and loses its gate.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

DoltLite source coverage

Metric Covered Total Coverage
Lines 95782 109050 87.83%
Branches 51497 72954 70.59%
Functions 4142 4344 95.35%

Merged 134 pooled raw profiles from the distributed Linux correctness jobs.

Per-file coverage (108 files)
File Lines Branches Functions
src/btree_orig_api.c 94.02% 87.50% 95.45%
src/chunk_file.c 100.00% 100.00% 100.00%
src/chunk_index.c 93.45% 78.68% 94.59%
src/chunk_index_spool.c 97.38% 84.62% 100.00%
src/chunk_refs.c 95.20% 81.46% 94.59%
src/chunk_staging.c 98.24% 83.33% 100.00%
src/chunk_store.c 93.10% 76.00% 100.00%
src/chunk_store_commit.c 90.52% 72.09% 100.00%
src/chunk_store_lock.c 93.29% 75.20% 100.00%
src/chunk_store_refs_api.c 94.22% 79.35% 100.00%
src/chunk_wal.c 87.52% 65.94% 94.59%
src/doltlite.c 100.00% 100.00% 100.00%
src/doltlite_add.c 89.00% 73.24% 100.00%
src/doltlite_ancestor.c 92.02% 78.04% 100.00%
src/doltlite_at.c 92.64% 68.99% 100.00%
src/doltlite_blame.c 81.63% 63.55% 100.00%
src/doltlite_branch.c 86.56% 74.58% 100.00%
src/doltlite_branches.c 92.47% 75.83% 93.75%
src/doltlite_checkout.c 86.66% 71.29% 94.12%
src/doltlite_checkout_dot.c 86.71% 66.84% 100.00%
src/doltlite_cherry_pick.c 91.77% 75.72% 100.00%
src/doltlite_chunk_source.c 88.08% 70.14% 97.83%
src/doltlite_chunk_walk.c 94.31% 68.99% 100.00%
src/doltlite_clean.c 95.32% 72.84% 100.00%
src/doltlite_cmd.c 84.80% 74.83% 87.76%
src/doltlite_commit.c 95.10% 77.47% 100.00%
src/doltlite_commit_ancestors.c 96.99% 73.61% 100.00%
src/doltlite_commit_cmd.c 83.55% 71.14% 100.00%
src/doltlite_config.c 82.01% 72.22% 100.00%
src/doltlite_conflicts.c 87.21% 63.12% 97.89%
src/doltlite_constraint_violations.c 92.88% 63.40% 94.64%
src/doltlite_core.c 90.06% 72.88% 98.77%
src/doltlite_creds.c 86.77% 60.66% 100.00%
src/doltlite_dbpage.c 72.78% 48.19% 76.19%
src/doltlite_diff.c 87.89% 69.96% 97.50%
src/doltlite_diff_stat.c 85.24% 63.57% 92.59%
src/doltlite_diff_table.c 93.61% 76.79% 100.00%
src/doltlite_docs.c 75.00% 37.50% 90.91%
src/doltlite_dump.c 88.32% 70.42% 100.00%
src/doltlite_engine_stats.c 88.89% 76.47% 90.91%
src/doltlite_framed.c 84.28% 67.62% 100.00%
src/doltlite_gc.c 79.96% 60.03% 88.00%
src/doltlite_hashof.c 81.64% 76.90% 100.00%
src/doltlite_history.c 94.02% 77.14% 100.00%
src/doltlite_http_remote.c 92.01% 71.97% 100.00%
src/doltlite_ignore.c 74.01% 55.38% 90.00%
src/doltlite_log.c 95.09% 76.21% 100.00%
src/doltlite_merge.c 94.11% 71.36% 98.00%
src/doltlite_merge_cmd.c 83.61% 69.53% 89.80%
src/doltlite_merge_constraints.c 90.21% 74.38% 100.00%
src/doltlite_merge_constraints_check.c 88.67% 68.69% 100.00%
src/doltlite_merge_constraints_fk.c 85.99% 61.89% 95.65%
src/doltlite_merge_constraints_notnull.c 100.00% - 100.00%
src/doltlite_merge_constraints_strict.c 100.00% - 100.00%
src/doltlite_merge_constraints_unique.c 87.83% 61.86% 100.00%
src/doltlite_merge_generated.c 96.63% 83.75% 100.00%
src/doltlite_merge_index_key.c 87.02% 68.44% 100.00%
src/doltlite_merge_pass1.c 93.24% 75.53% 100.00%
src/doltlite_merge_pass2.c 78.75% 55.43% 95.65%
src/doltlite_merge_predetect.c 89.53% 74.33% 100.00%
src/doltlite_merge_rebuild.c 94.96% 73.16% 100.00%
src/doltlite_merge_rows.c 90.99% 72.34% 100.00%
src/doltlite_merge_schema.c 92.36% 72.83% 98.25%
src/doltlite_merge_status.c 91.98% 73.53% 92.31%
src/doltlite_merge_vbase.c 81.88% 71.50% 95.00%
src/doltlite_nonlocal.c 91.39% 75.57% 97.67%
src/doltlite_patch.c 69.95% 53.66% 91.30%
src/doltlite_rebase.c 84.21% 62.99% 98.77%
src/doltlite_record.c 84.71% 70.29% 100.00%
src/doltlite_ref.c 97.43% 79.72% 100.00%
src/doltlite_remote.c 90.77% 72.16% 96.84%
src/doltlite_remote_sql.c 81.21% 70.90% 97.73%
src/doltlite_remotesrv.c 81.44% 70.26% 95.74%
src/doltlite_reset.c 88.01% 70.96% 100.00%
src/doltlite_revert.c 83.18% 57.45% 100.00%
src/doltlite_schema_diff.c 91.05% 70.30% 96.97%
src/doltlite_schemas.c 68.13% 53.96% 78.95%
src/doltlite_status.c 92.44% 73.59% 98.15%
src/doltlite_tag.c 91.77% 73.68% 94.12%
src/doltlite_tests.c 87.08% 72.73% 96.97%
src/doltlite_tls.c 88.13% 71.43% 100.00%
src/doltlite_verify_constraints.c 77.94% 64.02% 100.00%
src/doltlite_workspace.c 81.86% 61.82% 96.49%
src/pager_shim.c 60.16% 63.93% 40.71%
src/prolly_btree.c 90.17% 73.05% 95.40%
src/prolly_btree_catalog.c 87.67% 72.73% 97.12%
src/prolly_btree_cursor.c 95.49% 75.22% 100.00%
src/prolly_btree_cursor_count.c 82.44% 61.83% 100.00%
src/prolly_btree_cursor_payload.c 83.99% 65.58% 97.30%
src/prolly_btree_cursor_seek.c 90.84% 73.04% 100.00%
src/prolly_btree_mutation.c 91.96% 72.52% 98.41%
src/prolly_btree_orig.c 96.31% 78.12% 95.89%
src/prolly_btree_state.c 92.80% 66.90% 97.48%
src/prolly_btree_txn.c 87.91% 71.89% 99.12%
src/prolly_cache.c 95.76% 83.13% 100.00%
src/prolly_check.c 76.53% 70.45% 100.00%
src/prolly_chunker.c 95.39% 81.48% 100.00%
src/prolly_cursor.c 95.67% 90.20% 100.00%
src/prolly_diff.c 92.47% 80.13% 100.00%
src/prolly_hash.c 100.00% 100.00% 100.00%
src/prolly_hashset.c 94.39% 86.11% 100.00%
src/prolly_mutate.c 87.20% 76.26% 100.00%
src/prolly_mutmap.c 98.42% 89.97% 100.00%
src/prolly_node.c 91.07% 79.11% 100.00%
src/prolly_three_way_diff.c 95.88% 89.58% 100.00%
src/prolly_three_way_merge.c 88.54% 75.31% 100.00%
src/prolly_xxhash.c 100.00% 100.00% 100.00%
src/sortkey.c 94.13% 84.20% 100.00%

Download HTML and LCOV artifacts from this workflow run.

Tim and others added 2 commits December 3, 2026 21:40
dolt_branch calls it, and the amalgamation built with external remotes leaves
the remote SQL file out, so that build did not link.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The fallback sat in the branch of the chunk-source file that is still a prolly
build, so an amalgamation with chunk sources disabled defined it twice.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant