# Apache Hudi table services: compaction, clustering, cleaning and archival

Table maintenance, read 10 Nov 2026

**The short answer.** Hudi runs four table services: compaction folds merge-on-read log files into base files, clustering rewrites file layout, cleaning removes old file versions after every commit by default, and archival trims the timeline. The Hudi documentation lists a default for each service, and Hudi 1.2.1 was released September 24, 2026.

## Compaction

Merge-on-read tables write updates to log files and need compaction to merge them into base files and bound read latency. Compaction has a scheduling step, which writes a plan to the timeline, and an execution step. The trigger strategy decides how often to schedule: NUM_COMMITS, NUM_COMMITS_AFTER_LAST_REQUEST, TIME_ELAPSED, NUM_AND_TIME or NUM_OR_TIME. The compaction strategy decides which file groups to compact; the default, LogFileSizeBasedCompactionStrategy, picks file groups with the most accumulated unmerged log data. Others order by log file count, bound the IO, or limit by partition or day.

By default compaction runs asynchronously, so ingestion latency is not blocked. Set hoodie.compact.inline to true to compact in the same job as the write. Hudi Streamer continuous mode, Flink and Spark Streaming run async compaction alongside ingestion, and a standalone HoodieCompactor can run it as a separate job. Incremental scheduling is on by default through hoodie.table.services.incremental.enabled and scans only partitions changed since the last compaction, which the docs say helps tables with many partitions. The Hudi metadata table has its own compaction, scheduled after 10 delta commits by default.

## Clustering

Clustering is a layout service. It stitches small files into larger ones and can sort data by chosen columns so query predicates skip more files. It runs async or sync, and records a REPLACE action on the timeline. It builds on Hudi's MVCC design so writers can continue while clustering runs.

A plan strategy chooses files, for example SparkSizeBasedClusteringPlanStrategy, and an execution strategy rewrites them, by default SparkSortAndSizeExecutionStrategy, with hoodie.clustering.plan.strategy.sort.columns naming the sort columns. SparkSingleFileSortPlanStrategy and a binary file-stitching strategy are documented for cases where records need not be reread. Inline clustering uses hoodie.clustering.inline and hoodie.clustering.inline.max.commits, and blocks the next ingestion round until it finishes.

## Cleaning

In Spark writers, cleaning runs inline after every commit by default (hoodie.clean.automatic is true) under the KEEP_LATEST_COMMITS policy, retaining 10 commits (hoodie.clean.commits.retained). Other policies are KEEP_LATEST_FILE_VERSIONS and KEEP_LATEST_BY_HOURS. hoodie.clean.max.commits schedules the cleaner every few commits, and hoodie.clean.async runs it alongside writing. Hudi 1.2.0 added hoodie.prewrite.cleaner.policy, off by default, which can clean or roll back failed writes before each write.

The number of commits retained also sets how far back incremental queries can read, so a shorter window saves storage and shortens incremental history.

## Timeline archival

Completed actions move from the active timeline to an LSM-structured archived timeline. hoodie.keep.max.commits defaults to 30 and hoodie.keep.min.commits to 20 instants in the active timeline. Archival removes side effects of completed or pending actions, such as uncommitted files, from storage before archiving them.

## Who runs it

Amazon EMR installs Hudi components by default when Spark, Hive, Presto or Flink is installed, and release 7.14.0 packages Hudi 1.0.2-amzn-3; you schedule or enable the services. Onehouse says its platform automates asynchronous table services for Hudi, Iceberg and Delta, and that claim is the vendor's. Starburst Galaxy treats Hudi tables as read-only, so it cannot run these services on them. Compare with [Delta OPTIMIZE and VACUUM](/maintenance/delta-optimize-and-vacuum/) and [Iceberg compaction](/maintenance/iceberg-compaction/).

## Other maintenance pages

- [Iceberg compaction: rewrite_data_files, strategies, platforms](/maintenance/iceberg-compaction/)
- [Iceberg snapshot expiry and orphan file removal](/maintenance/snapshot-expiry-and-orphan-files/)
- [Delta Lake OPTIMIZE and VACUUM: defaults and platform automation](/maintenance/delta-optimize-and-vacuum/)
- [Which platforms automate Iceberg compaction](/maintenance/compaction-on-each-platform/)

## Sources

- Apache Hudi compaction: https://hudi.apache.org/docs/compaction (read 10 Nov 2026)
- Apache Hudi clustering: https://hudi.apache.org/docs/clustering (read 10 Nov 2026)
- Apache Hudi cleaning: https://hudi.apache.org/docs/cleaning (read 10 Nov 2026)
- Apache Hudi timeline and archival: https://hudi.apache.org/docs/timeline (read 10 Nov 2026)
- Apache Hudi latest release (GitHub API): https://api.github.com/repos/apache/hudi/releases/latest (read 10 Nov 2026)
- Apache Hudi on Amazon EMR: https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-hudi.html (read 10 Nov 2026)
- Amazon EMR 7.x release versions: https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-release-app-versions-7.x.html (read 10 Nov 2026)
- Onehouse about: https://www.onehouse.ai/about-us (read 10 Nov 2026)
- Starburst Galaxy Hudi: https://docs.starburst.io/starburst-galaxy/data-engineering/working-with-data-lakes/table-formats/gl-hudi.html (read 10 Nov 2026)

Last reviewed 10 Nov 2026. Canonical: https://datalakehousecompare.com/maintenance/hudi-table-services/
