Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt Include
Merge On Read (MOR)
Merge On Read (MOR)
nopaneltrue

Compactor

Realtime Readers will perform in-situ merge of these delta log-files to provide the most recent (committed) view of the dataset. To keep the query-performance in check and eventually achieve read-optimized performance, Hudi supports
compacting these log-files asynchronously to create read-optimized views.

Asynchronous Compaction involves 2 steps:

Compaction Schedule : Hudi Write Client exposes API to create Compaction plans which contains the list of `file slice` to be compacted atomically in a single compaction commit. Hudi allows pluggable strategies for choosing file slices for each compaction runs. This step is typically done inline by Writer process as Hudi expects only one schedule is being generated at a time which allows Hudi to enforce the constraint that pending compaction plans do not step on each other file-slices. This constraint allows for multiple concurrent `Compactors` to run at the same time. Some of the common strategies used for choosing `file slice` for compaction are:
BoundedIO - Limit the number of file slices chosen for a compaction plan by expected total IO (read + write) needed to complete compaction run
Log File Size - Prefer file-slices with larger amounts of delta log data to be merged
Day Based - Prefer file slice belonging to latest day partitions

Compactor : Hudi provides a separate API in Write Client to execute a compaction plan. The compaction plan (just like a commit) is identified by a timestamp. Most of the design and implementation complexities for Async Compaction is for guaranteeing snapshot isolation to readers and writer when multiple concurrent compactors are running. Typical compactor deployment involves launching a separate spark application which executes pending compactions when they become available. The core logic of compacting file slices in the Compactor is very similar to that of merging updates in a Copy-On-Write table. The only difference being in the case of compaction, there is an additional step of merging the records in delta log-files.

Here are the main API to lookup and execute a compaction plan.

...