Skip to main content

FORMAT_KEY

Constant FORMAT_KEY 

Source
const FORMAT_KEY: &str = "mira.format";
Expand description

On-disk format version, stamped into every table’s footer metadata beside the CRC — a place that already exists, so no second file and no second fsync. Read before the reader trusts anything else in the file.

What it is for: three of the five logs tables are read positionally (attrs.rs, query.rs: column(3) is the str value column), so inserting a field into a schema in schema.rs does not fail against blocks already on disk — it reinterprets them. Without a version there is nothing a reader can look at to tell the two layouts apart.

ponytail: this records the version and refuses the future — a block from a newer Mira is a named error, not a misparse — and that is all. It does not make an older block readable by a newer binary, because there is no migration to run and one version of one layout to run it on. The upgrade path, in order: move the positional readers onto column_by_name (which the root tables already use, which is why LogRecord.event_name could be added without rewriting a block); then a column insertion needs no bump at all. Until that lands, the rule is that any change to a published table’s column list bumps FORMAT_VERSION, and the compatibility branch for the older layout goes next to the check in open_table.