On-disk formats
Every format vcon-server writes to disk or to a bucket, with its version; what each release since 0.4.0 wrote; the rule a new build keeps for the data of an older one; and how a release's data is kept in the repository and tested.
vcon-server keeps its data in a few formats. Each one carries a version number. This page lists them, the versions each release wrote, and the rule every build keeps. To move a server to a newer release, see upgrade.
The rule
- A build opens the data directory of every release since 0.4.0. It
brings each catalog up to its own version the first time it opens it,
each in one transaction, so a migration that fails leaves the old
version whole. A PostgreSQL catalog is brought up to date by
vcon-server migrate, never by a server at start. - A build refuses a version newer than its own, and names it:
schema version 14 is not one this build knowsfor a catalog in the data directory,the database schema is newer than this binaryfor PostgreSQL. So an older binary cannot open data that a newer one has opened, and the way back from an upgrade is a copy taken before it. - A change to a format raises its version. The same change adds the migration, the version's row on this page and a CHANGELOG entry, and the next release adds its own data to the repository (see the data of each release).
The rule covers 0.4.0 and later. Release 0.3.0 and earlier are not tested.
The formats
| Format | What it is | Version | Where |
|---|---|---|---|
catalog | The SQLite catalogs, encrypted with SQLCipher: server.sqlite (tenants, their limits, keys, users, sessions and its audit log) and each tenant's catalog.sqlite (its vCons, versions, tombstones, storage counter and audit log). The version is SQLite's user_version. | 13 | the data directory |
postgres | The schema of the PostgreSQL catalog, a preview, in place of the catalogs above. | 18 | the database |
envelope | The first byte of every sealed blob (an object, a wrapped key, and in PostgreSQL a sealed column): AES-256-GCM with a 12-byte nonce and a 16-byte tag. | 1 | objects and catalogs |
key-wrap | The first byte of a key that a key backend other than the master key file wrapped: the backend's kind, the reference of its key, and the backend's ciphertext. This release writes none: the command line moves keys to a master key file only, and the other backends come in later releases. | 1 | none yet |
parquet-storage | The format of each manifest of Parquet storage in a bucket. | vcon-server.parquet-storage/1 | the bucket |
export-manifest | The format of the manifest that export parquet writes. | 1 | the export directory |
export-columns | The vcon-server.schema value in the key-value metadata of each Parquet file export parquet writes: the columns. | 1 | the export directory |
The server reads back the first five. The two export formats are written for other programs, such as DuckDB, and the server never reads them.
The key of each catalog is HKDF-SHA256 of its parent key, with no salt and
the info vcon-server/v1 catalog: the master key's for server.sqlite, the
tenant key's for a tenant's catalog. Security
describes the key hierarchy.
What each release wrote
| Release | catalog | postgres | envelope | key-wrap | parquet-storage | export-manifest | export-columns |
|---|---|---|---|---|---|---|---|
| 0.4.0 | 4 | none | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.1 | 4 | none | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.2 | 4 | none | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.3 | 4 | none | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.4 | 9 | none | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.5 | 9 | none | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.6 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.7 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.8 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.9 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.10 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.11 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.12 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.13 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.14 | 9 | 13 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.15 | 9 | 14 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.16 | 9 | 14 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.17 | 10 | 14 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.18 | 10 | 15 | 1 | none | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.19 | 11 | 16 | 1 | 1 | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.20 | 13 | 18 | 1 | 1 | vcon-server.parquet-storage/1 | 1 | 1 |
| 0.4.21 | 13 | 18 | 1 | 1 | vcon-server.parquet-storage/1 | 1 | 1 |
none under key-wrap: the release has no such format. none under
postgres: the release binary has no PostgreSQL catalog. The postgres
feature, a preview, is in the release binaries from 0.4.6 on. A build from
source with that feature made schema version 1 at 0.4.2 and 0.4.3, and 6 at
0.4.4 and 0.4.5.
The data of each release
The repository keeps a data directory written by each release's own binary, under crates/vcon-server/tests/data/formats, one directory per release. Each holds:
data/: the data directory as the release left it;master.key: its master key, the SHA-256 of a fixed text and the release number. The key protects test data only;manifest.json: every version kept, with the SHA-256 of its body; every uuid purged; and what made the directory (the release archive's sha256, the binary's sha256, the container image).
The workload is the same for each release: two tenants, one with the
default retention period and one with 0d, ten vCons each; replaced vCons
(hidden versions), deleted vCons (kept under the default period, purged in
the request under 0d), legal holds on a live, a deleted and a replaced
vCon, a restart whose sweep purges what is due, and the audit records of
every step. From 0.4.4, which added users, it also makes two users with
memberships. The size of each release's data, the bytes of every file
under its directory (written by scripts/release_list.py from the
directories themselves):
| Release | Bytes |
|---|---|
| 0.4.0 | 246,084 |
| 0.4.1 | 246,084 |
| 0.4.2 | 246,084 |
| 0.4.3 | 246,084 |
| 0.4.4 | 299,479 |
| 0.4.5 | 299,479 |
| 0.4.6 | 299,479 |
| 0.4.7 | 299,479 |
| 0.4.8 | 299,479 |
| 0.4.9 | 299,479 |
| 0.4.10 | 299,480 |
| 0.4.11 | 299,480 |
| 0.4.12 | 299,480 |
| 0.4.13 | 299,480 |
| 0.4.14 | 299,480 |
| 0.4.15 | 299,480 |
| 0.4.16 | 299,480 |
| 0.4.17 | 299,480 |
| 0.4.18 | 299,480 |
| 0.4.19 | 299,480 |
| 0.4.20 | 405,976 |
| 0.4.21 | 405,976 |
The test formats.rs runs on every change, against a copy of each release's data. For each release:
checkpasses, and counts each tenant's kept versions;- every kept version reads back byte-equal to the body the release stored, in the order the release kept them, and each purged uuid stays gone;
server.sqliteis at this build's version after the first open, and a second open changes no file;server.sqliteset to one version past this build is refused by name, and the data is left as it was; the wrong master key changes nothing;- for 0.4.0 to 0.4.3, a migration made to fail at its last step leaves version 4 whole, and opens once the cause is gone;
- every object starts with the
envelopeversion this page states, and thecatalogversion this page states is the one the release wrote.
The test also holds this page to the list of formats in the code (formats.rs).
The data in PostgreSQL and Parquet storage
Each release from 0.4.6, the first built with the postgres feature, also
has a deployment with its catalogs in PostgreSQL and its objects in an S3
bucket with Parquet storage on, under
crates/vcon-server/tests/data/formats-postgres.
The release's own binary wrote it against PostgreSQL 16.15 and RustFS
1.0.4, the images of CI's backends-postgres job. Each directory holds:
dump.sql:pg_dump --insertsof the database, made by PostgreSQL 16, the oldest major CI runs, so that it loads into 16 and 18 alike;bucket/: every object the bucket held, by its key: the Parquet files of the pack run at start, the versions stored after it as objects, the storage manifests and the claim;data/: the lock files;master.key, made as above;manifest.json: every version kept, with the SHA-256 of its body and where it is (a Parquet file or an object); every uuid purged; the schema version the release wrote; and what made the directory.
The workload is the one above, then a restart with Parquet storage on,
whose pack run packs every object, then two more vCons in each tenant,
stored as objects. The size of each release's deployment, the bytes of
every file under its directory (written by scripts/release_list.py):
| Release | Bytes |
|---|---|
| 0.4.6 | 159,496 |
| 0.4.7 | 159,500 |
| 0.4.8 | 159,490 |
| 0.4.9 | 159,493 |
| 0.4.10 | 159,657 |
| 0.4.11 | 159,497 |
| 0.4.12 | 159,489 |
| 0.4.13 | 159,494 |
| 0.4.14 | 159,494 |
| 0.4.15 | 160,747 |
| 0.4.16 | 160,906 |
| 0.4.17 | 160,751 |
| 0.4.18 | 163,649 |
| 0.4.19 | 164,626 |
| 0.4.20 | 195,405 |
| 0.4.21 | 195,399 |
On every change, the same test checks each release's files without a
database: the dump has no psql meta-command, every object starts with the
envelope version, every Parquet file starts and ends with Parquet's
magic bytes, and each
storage manifest states the parquet-storage format this page states.
In CI's backends-postgres job, on PostgreSQL 16 and 18, it loads each
dump into a database of its own and the objects into a bucket of its own,
and:
checkpasses; every kept version, packed or an object, reads back byte-equal, in the order the release kept them, and each purged uuid stays gone;migratefinds the schema current and changes nothing; a schema set to one version past this build is refused by name; the wrong master key opens nothing;- the restored deployment stores and reads a new vCon, a missing object is
named damaged by
check, andservewithout the[storage.parquet]table is refused; - held versions outlive the start-up sweep under a
0dperiod, and the pack run at start packs the late objects, each still read back.
Add the data of a new release
After each release, add its data, so every later build opens it.
Before you start, you need:
- Docker, and the container image the script names (
debian:trixie-slim, pinned by its digest in the script); openssland Python 3 on the host;- the release's archives pinned in
scripts/docs-test-pins.txt.
Steps:
-
Pin the release's archives in
scripts/docs-test-pins.txt. That file is the one list of releases:scripts/release_list.pyreads it for the fixture script, the test modules oftests/formats.rs, the size tables above and the ranges of the production checklist. -
Write its data. The script downloads the pinned archive for this host's architecture through
scripts/fetch-pinned.sh, which checks its sha256, and runs the binary in throw-away containers:python3 -I scripts/make-format-fixtures.py --cache ~/.cache/vcon-format-fixtures --release 0.4.9 -
Write its PostgreSQL deployment. The script starts the servers of
scripts/pg-test-server.shand a RustFS container, and removes them after:python3 -I scripts/make-format-fixtures.py --cache ~/.cache/vcon-format-fixtures --postgres --release 0.4.9 -
Add a row for the release to the table of what each release wrote, and write the test modules of
tests/formats.rs, the size tables and the checklist's ranges again:python3 -I scripts/release_list.py write -
Commit the new directories with the pins, the pages and the test.
Verify: cargo test -p vcon-server --test formats passes; with the
servers of scripts/pg-test-server.sh and an S3 store named in the
VCON_TEST_S3_* variables, so does
cargo test -p vcon-server --features postgres,backend-tests --test formats postgres::.
python3 -I scripts/release_list.py check, which the commit hook runs,
passes.
When it does not work:
-
release_list: 0.4.9 is pinned, and .../formats/0.4.9 does not exist: the release's archives are pinned and its data is not written yet. Run steps 2 and 3. -
0 pins name /v0.4.9/vcon-server-0.4.9-...: the release's archives are not inscripts/docs-test-pins.txtyet. Add them first. -
serve exited 1: the release refused the configuration or the data directory. The message ends with the server's last log lines. -
A test names the release and a version: the page's row states another version than the release wrote. Correct the row; never edit the data.
-
the pack run left N objects: Parquet storage did not pack every object in the time a start is given. The server's log lines say why. -
--postgres takes only ...: the release is older than 0.4.6, which has nopostgresfeature.
Source of this page: website/content/docs/on-disk-format.md