Snapshot expiry is hygiene, not access control

source: Apache Iceberg docs — Spark procedures, expire_snapshots

A requirement I was handed said: analysts must only see the current snapshot, and the platform must expire snapshots on a schedule, but "do not delete snapshots merely to prevent querying them". The two halves sound related and are not.

Snapshot expiry exists for storage and metadata hygiene. Every commit adds a snapshot, every rewrite leaves replaced data files referenced by older snapshots, and metadata.json grows with each one. Without expiry a warehouse writing 250 GB a day retains every rewritten file forever; with a seven-day window the rewrites fall out and net growth is what was actually added. Orphan-file removal cleans up what failed commits left behind. The schedule for both is an operations decision: nightly after the ETL, with per-layer windows set as table properties (history.expire.max-snapshot-age-ms, history.expire.min-snapshots-to-keep).

Keeping analysts on the current snapshot is an authorization decision. On Trino, a rule hides every table$snapshots-style metadata table from non-admins, and FOR VERSION AS OF with a guessed id fails. On Kyuubi the AuthZ plugin does not cover metadata tables, so the compensating controls are no storage credentials and the fact that time-travel reads pass the same masks and filters as current reads.

If you shorten retention to stop people querying history, you have coupled your storage policy to a security gap, and the first incident that needs a three-day-old snapshot will find it gone.

The rule: set retention for the platform's needs, and keep the "current snapshot only" promise in the engines' policies, where it can be tested.