Skip to content

Operate redaction versions

Every document collection and each of its redaction versions is a Lance table. With lanceMaintenance.enabled (the default), the daily lakehouse maintenance schedule also runs the unstructured runner’s maintain stage, and maintainOnLoad runs the same upkeep at the end of every documents load.

The upkeep compacts each table, refreshes its indexes (the vector index is rebuilt when more than 10 % of rows are outside it) and removes old table versions:

lanceMaintenance:
enabled: true
versionRetentionDays: 14 # versions older than this are removed
maxRetainedVersions: 200 # hard ceiling after maintenance
maintainOnLoad: true
vectorIndexMinRows: 50000 # keep equal to the engine's vectorSearch.indexMinRows
  • Retention and the ceiling. Within retention, the cleanup keeps the newest maxRetainedVersions versions, so a table that writes hundreds of versions a day stays under the ceiling. Exceeding it turns the nightly run red (see below).
  • What is never removed: a version a reader may still pin (superseded less than the engine’s pin window ago) and a tagged version (pinned analyses). The pin and tag windows keep ten minutes of margin. Retention itself, which serves erasure, is never widened for a pin.
  • The run report gives versions_before and the reason for the cleanup window.

Every commit to a Lance table (a load batch, a materialization, a deletion) is a table version, and the upkeep keeps old ones so that readers pinned to a version can finish and erasure is enforced on schedule. The ceiling (maxRetainedVersions, 200 by default) bounds how many a table keeps, because listing a table’s versions slows down as they pile up, until the object store refuses it.

The cleanup normally brings a table under the ceiling on its own. A table that is still above it after the cleanup is reported as an error (versions_ceiling_exceeded): the nightly maintain job ends with a non-zero exit, a documents load whose closing upkeep hits it ends red (maintenanceErrors in its summary), and the report gives versions_before, the versions retained and cleanup_window_reason. Your data is served as before; what failed is the upkeep. It happens when something prevents the removal of versions the ceiling would otherwise take:

cleanup_window_reason What kept the versions What to do
pins Versions a reader may still pin (superseded less than the engine’s pin window ago): many versions were written in a short time. Nothing: the next run removes them once the pin window has passed. If it recurs every night, look for a job that writes a table far more often than it should.
tag A tagged version (a pinned analysis) keeps every newer version, and also caps retention (retention_enforced: false). Delete the tag once the analysis no longer needs it; keeping a long-lived tag is your decision, and while it exists retention is not enforced for that table.

The documents load writes in batches (one commit per batch of documents and table), so a large first load no longer leaves hundreds of versions behind. Do not raise maxRetainedVersions to silence the error: it hides the cause and makes listing the table slower.

Give the bundled object store enough memory for large tables (objectStore.rustfs.resources, request 512Mi and limit 2Gi by default in the standard-tenant chart): listing the versions of a large table is memory-heavy.

The documents load removes what a source deleted (see Materialization) only after recording each removal on the cell’s audit trail, as the connector’s sync run (actor job:connector-sync:<connector>). The orchestrator gives the load job the audit endpoint, its token and its signing key, as it does for the other jobs that delete rows.

This is fail-closed:

  • No audit trail configured (for example, a load job you launch yourself without the audit settings): nothing is removed, and each run logs deletion marker …: no audit spine configured for the removals.
  • Audit trail unavailable, or the record refused: nothing is removed, and the run logs that the audit trail did not record the removal.

In both cases the deletion marker is kept and the next load tries again; until then the deleted document stays in the base and version tables and is still served. If documents removed at the source keep appearing in answers, check the load job’s logs for these lines first.

A listing that would remove too many documents is refused on its own (the safety cap), whatever the audit trail does.

A collection whose stored definition does not compile on its own (for example one written by an older release) is refused alone when the engine loads: the engine starts and serves the rest of the tenant. A joint entity that names the refused collection is refused with it, the document runner never loads into it, and the table and media sweeps remove nothing while it is refused. Each refusal is logged and audited (error_raised, component: manifest_load), never with document content.

The nightly upkeep also removes what no version owns any more, for example after a version was removed before its purge existed, or after a collection document was edited by hand:

  • Unowned media (media_swept): media-store directories with a version table’s shape that no declared version, and no deleted version still being purged, references.
  • Unowned version tables (lance_table_swept): version tables of a declared collection whose tag no declared version, and no deleted version still being purged, references.

Both are fail-safe: they never touch a store’s own directories, they list what they judge before reading the manifest, and they remove nothing when the collection’s manifest cannot be read.

Each sweep records the removal in the audit trail first and removes nothing when the audit trail does not take the record. A removal is therefore never unaccounted for: an audit outage delays the sweep, it does not hide it.

An event recorded after the action it describes, because its emitter could not reach the audit trail at the time, is a late record: it carries occurred_at (the action’s time), late: true and a late_reason from a closed set. Its recording time is never back-dated. An incomplete or inconsistent marking is refused.

Retiring and deleting a version are tenant-administrator actions, described in Redaction versions. For operators:

  • a deletion is refused while a connector run feeding the collection is queued or running;
  • each store’s removal is idempotent: when a store could not be cleaned, the version’s deletion record says so (complete: false) and the next delete of the same name finishes it;
  • a deleted version’s table, media, copies, samples, review marks and document links go; the originals and the extraction cache stay, because they belong to the documents.
Key Rotation
Opaque document ids (redaction.docIdKeyRing) Prepend a new key. Tables keep the key they were written with while the ring holds it; a table whose key left the ring is refused at load until it is materialized again.
Media and copy tickets (redactionMedia.ticketKey) Set ticketKeyPrevious during a rotation.
Document links (documentLinks) Provide the previous key during a rotation; the copy-grant key pair is generated once.
Sample grant and work token (redactionSample) The previous work token is accepted during a rotation.

GET /v1/tenants/{tenant}/tenant-health on the management API reports, per component (postgres, storage, nessie, trino, tenantConfig, catalogApi), {status, message} with status one of healthy, unhealthy, unknown or not_installed.

  • nessie, trino (the coordinator) and catalogApi are found by their Service labels (app.kubernetes.io/name, plus app.kubernetes.io/component=coordinator for Trino) in the tenant namespace and judged by the Service’s ready endpoints, whatever the release is called.
  • A component the tenant does not run is {"status": "not_installed"}. It is not counted as unhealthy, and clients must not treat it as down.
  • A discovered component without a ready endpoint is {"status": "unhealthy", "message": "No ready endpoints"}.

The management API’s Role needs read-only get and list on services and endpoints; the chart grants them.