Tables always in order,
with scheduled jobs.
Scheduled jobs expire old versions, remove unused files, and compact small files in the selected Iceberg and Delta Lake tables. See what is configurable in each format.
- Scheduled maintenance
- Apache Iceberg
- Delta Lake
- What is configurable
- Scenario: snapshot expiration outside the scheduled time
Scheduled maintenance
The tdp-iceberg and tdp-deltalake charts offer scheduled jobs to run maintenance on the selected tables.
Each job is a Kubernetes CronJob that runs Spark in its own Pod.
Each one handles a stage of the table lifecycle: expiring old versions, removing unused files, compacting small files or recording the history.
The jobs come with a defined schedule, and the most resource-intensive ones start disabled.
The maintenance operations are Iceberg and Delta Lake features. The execution through CronJobs, the schedules and the profiles enabled below are choices of the TDP Kubernetes charts. Each job processes the tables listed in tables or, with an empty list, all the tables in the catalog, and ends with a failure when any of them fails.
Apache Iceberg
Removes the snapshots older than the period in maintenance.jobs.expireSnapshots.retentionDays, always keeping the most recent ones of each table (retainLast), and the data files used only by them. Keeps storage under control and the table metadata small. Enabled in enabled, with the schedule in schedule.
Removes the files, older than the interval in maintenance.jobs.removeOrphanFiles.olderThanDays, that no table metadata references, such as those left by failed writes. Enabled in enabled, with the schedule in schedule. The interval must be longer than the duration of any write in progress: with a shorter interval, files from a write not yet completed may be removed and corrupt the table.
Compacts small files into larger files, which reduces the metadata and makes queries more efficient. Disabled by default, because it consumes more resources. When enabled, it runs on the schedule of the job.
Delta Lake
Removes the files that the transaction log no longer references and that are past the retention set in maintenance.jobs.vacuum.retentionHours, freeing up storage space. Enabled in enabled, with the schedule in schedule.
Compacts small files into larger files, which speeds up reads. Enabled in enabled, with the schedule in schedule.
Groups in the same files the records with close values in the chosen columns, so that queries that filter on these columns read fewer files. Disabled by default. It processes only the listed tables, each with its own columns, and, when enabled, it runs on the schedule of the job.
Records the change history of the table for audit. Disabled by default. When enabled, it runs on the schedule of the job.
The Delta Lake jobs configuration disables the retention safety check (spark.databricks.delta.retentionDurationCheck.enabled=false), so Delta Lake does not block a VACUUM with a short retention.
In production, a retention below the default value of maintenance.jobs.vacuum.retentionHours makes reads of old versions and time travel to them stop working, and reads and writes in progress may fail and corrupt the table.
What is configurable
The adjustments are made in the Helm values of the maintenance component used: Iceberg or Delta Lake. The links below lead to the corresponding section of each guide.
Configurable
Enable and schedule
Each job can be enabled or disabled and has its own schedule, as a cron expression.
Job parameters: Iceberg · Delta Lake
Configurable
Tables and retention
Each job processes the tables listed in tables, or all those in the catalog with an empty list. The jobs that remove files have their own retention.
Tables and retention: Iceberg · Delta Lake
Configurable
Resources
The CPU and memory of the maintenance jobs are defined in the chart, for each environment.
Job resources: Iceberg · Delta Lake
Scenario: snapshot expiration outside the scheduled time
Situation: after a load with many changes, the team wants to expire the snapshots without waiting for the next scheduled run.
What TDP does: expiration is a CronJob of the chart, and a Job created from it runs the same job immediately:
kubectl -n <NAMESPACE> get cronjob | grep expire-snapshots
kubectl -n <NAMESPACE> create job --from=cronjob/<EXPIRE_SNAPSHOTS_CRONJOB> <JOB_NAME>
Effect: expiration runs immediately, with the same tables and the same retention as the scheduled job.
See also
Formats
Open tables with Iceberg and Delta Lake
Schema, ACID transactions, versions and time travel on the storage files.
Storage
Storage and catalog
Ozone or another S3 endpoint for the files. Hive Metastore and Trino catalogs to locate the tables.