Inside Apache XTable: from source metadata to target commits
How the controller picks a full or incremental pass for each target, the four different rules a source uses to decide it is safe to resume, and what the code does when a target fails.
- 1. How each source finds the logical table
- 2. The internal model
- 3. Choosing the mode
- 4. The incremental pass
- 5. The snapshot pass
- 6. What happens when something fails
- 7. Where to read the code
- Checked against the source
- Key takeaways
- References
- Trademarks
TL;DR
A sync is a loop over targets. For each one, the controller decides between a snapshot pass and an incremental pass, reads the source through a
ConversionSource, andTableFormatSyncapplies the result in a fixed order.
- Every source answers the same question differently: is it safe to resume from this instant? Hudi checks the cleaner, Iceberg walks the snapshot parents, Delta looks for an active commit, and Paimon checks that snapshots still reach back that far.
- The mode is decided per target from the target’s own
XTABLE_METADATA. The most out-of-sync target sets how far back the source is read, and each target skips what it already has.- An incremental pass replays each source commit as a target commit. A snapshot pass writes the current file set in one.
- The internal model has 19 data types, six partition transforms and a file with partition values and column statistics. Anything outside that is dropped by design.
- Failures are contained per target. Nothing in the sync retries them, and a repeat run resumes from what each target recorded.
The architecture post
described the pieces. This one follows the data through them, in the order the
code runs it. Every claim was read from the 0.5.0-incubating source, and the
classes are named so you can open them.
1. How each source finds the logical table
A directory of Parquet files is not a table. Each source has to work out which files belong to the table now, which is why none of them lists the folder.
| Source | Where the logic lives | What it reads |
|---|---|---|
| Hudi | HudiConversionSource, HudiDataFileExtractor, HudiTableExtractor |
The timeline and file slices through Hudi’s own metadata classes |
| Iceberg | IcebergConversionSource, IcebergDataFileExtractor |
The current snapshot and its manifests |
| Delta | DeltaConversionSource, DeltaDataFileExtractor |
The Delta log’s current snapshot of add and remove actions |
| Paimon | PaimonConversionSource, PaimonDataFileExtractor |
Snapshots and manifests of the LSM tree’s top level |
| Parquet | ParquetConversionSource, ParquetDataManager |
The files under the base path, with footer metadata |
The Parquet row is the odd one: with no table metadata it has to list files and
read footers, which is why it is configured separately. It treats each file’s
modification time as its commit time, so incremental sync works from file
modification times, and its isIncrementalSyncSafeFrom is true when the earliest
file is not newer than the instant. All targets must be at the same instant, or it
fails with Parquet incremental sync does not support target formats synced to different
instants. This was read from the code and not run. For the others, a storage listing is never the source of truth. A folder
can hold replaced, cleaned or uncommitted files that the table’s own metadata
excludes.
2. The internal model
Each source fills the same structures in xtable-api.
Schema. An InternalSchema is a tree of fields. Each node has an
InternalType, and the full set is RECORD, ENUM, LIST, MAP, UNION,
UUID, FIXED, STRING, BYTES, INT, LONG, FLOAT, DOUBLE, BOOLEAN,
NULL, DATE, DECIMAL, TIMESTAMP and TIMESTAMP_NTZ. Every format’s schema
is mapped into that list by its own extractor (HudiSchemaExtractor,
IcebergSchemaExtractor, DeltaSchemaExtractor, PaimonSchemaExtractor,
ParquetSchemaExtractor) and back out again by the target. A type that is not in
the list has no path through the model.
Partitions. A partition field has a source field and one of YEAR, MONTH,
DAY, HOUR, VALUE or BUCKET. The table also carries a layout strategy, one
of HIVE_STYLE_PARTITION, DIR_HIERARCHY_PARTITION_VALUES or FLAT, which says
how partition values appear in file paths. Hudi sources read the partition spec
from configuration, which is the partitionSpec field you set, through
ConfigurationBasedPartitionSpecExtractor, or from the path.
Files. An InternalDataFile has a path, a size, a record count, a format,
partition values, column statistics and a last-modified time. Statistics come from
the source’s own metadata where it has them: Iceberg manifests carry them, and
Delta keeps them in the log. Hudi reads them from its metadata table and, where a
file has none that are usable, from the Parquet footer.
Changes. For an incremental pass the source builds a TableChange per commit,
holding an InternalFilesDiff (files added and removed) and the table as of that
commit.
3. Choosing the mode

RunSync builds its ConversionConfig with SyncMode.INCREMENTAL every time.
There is no flag for a full sync. ConversionController.getFormatsToSyncIncrementally
then walks the targets, and a target stays incremental only if it passes three checks:
- The target says so.
isIncrementalSyncSafe()on the target defaults to true, and in0.5.0only the Hudi target overrides it. It returns false for an existing Hudi target that has a timeline but no column-stats index, which is what a table synced by0.4.0looks like. The next sync then takes a snapshot pass so every file is registered again with its statistics. - The target has a sync record. The last synced instant and any pending instants come from its
XTABLE_METADATA. With neither, the controller logsNo previous InternalTable sync for target. Falling back to snapshot sync. - The source can resume from there. The earliest of the last synced instant and the pending instants goes to
isIncrementalSyncSafeFrom. If that returns false, the controller logsIncremental sync is not safe from instant ... Falling back to snapshot sync.
Targets that fail go to a snapshot pass and the rest go incremental, in the same invocation.
What “safe” means, per source
| Source | isIncrementalSyncSafeFrom(instant) is true when |
|---|---|
| Hudi | A commit exists as of the instant, and the last completed clean has not removed it: the clean’s earliest commit to retain must not be after the instant |
| Iceberg | Walking back from the current snapshot through parent snapshots reaches a snapshot at or before the instant. A missing or expired parent returns false |
| Delta | The log has an active commit at or before the instant |
| Paimon | Snapshots exist, the instant is not in the future, and the earliest snapshot is not newer than the instant, so expiry has not removed it |
The Hudi row is why the cleaner matters. A clean that retained fewer commits than your sync lag makes the next run a snapshot pass, as the Hudi source post shows with a failing read.

4. The incremental pass
syncIncrementalChanges collects the sync records of the incremental targets and
calls getMostOutOfSyncCommitAndPendingCommits. That picks the oldest last-synced
instant among them, and the union of their pending instants. The source reads
changes from that point once, and TableFormatSync.syncChanges applies them to each
target. A change applies to a target only if its commit time is after that target’s last
synced instant or is in its pending list, so a target that already has it skips it.

Each source commit becomes one commit in the target. A target that was three commits behind ends the run with three new target commits, which is why a long gap is slower than a short one even before any fallback.
The pending instants exist for commits that were still in flight at the last sync,
such as a Hudi instant that had not completed. They are stored in
XTABLE_METADATA next to the last synced instant so a later run picks them up.
5. The snapshot pass
When any target needs a snapshot, the source reads its current state once with
getCurrentSnapshot(), which returns an InternalSnapshot: the table, the files
grouped by partition, the pending commits and a source identifier. Every
snapshot target applies it with syncFilesForSnapshot. The cost grows with the
number of files and commits the source has to read, not with the number of rows.
6. What happens when something fails
Each target runs in its own try block in TableFormatSync. An exception becomes
an error result for that format, with an ErrorDetails object that includes a
canRetryOnFailure flag, and the loop moves on. The controller then logs
Sync is successful for the following formats ... for the successes and
Sync failed for the following formats ... for the failures.

Three things follow from that code:
- A partial result is normal. One format can succeed while another fails, so check for the failure line, not only the success line.
- Nothing retries. The flag tells a caller whether a retry makes sense. No code in the sync acts on it.
- A failed target stops for the run. If a target fails on one commit,
syncChangesskips it for the remaining commits in that run, while the other targets continue. - A repeat run resumes. The state written first in each target’s sync (
syncMetadata, before schema and files) is what the next run reads. A target that failed before completing keeps its previous record, and the run after takes the mode from that.
7. Where to read the code
| To understand | Open |
|---|---|
| The decision and the loop | ConversionController.syncTableFormats, getFormatsToSyncIncrementally, isIncrementalSyncSufficient |
| Call order and error handling | TableFormatSync.syncSnapshot, syncChanges, getSyncResult |
| The stored state | TableSyncMetadata and the XTABLE_METADATA constant |
| One source’s safety check | isIncrementalSyncSafeFrom in each *ConversionSource |
| Type mapping | InternalType and the *SchemaExtractor classes |
| One target’s writer | each *ConversionTarget, and ConversionTargetFactory |
Checked against the source
Every statement above comes from the 0.5.0-incubating tag. The four
isIncrementalSyncSafeFrom rules and the controller’s three checks are quoted
from the code, and the log messages are the strings in ConversionController.
The two logs shown for a first run and an incremental run are from the
first sync lab.
Parquet’s behaviour was read from its package listing and was not traced in depth.
Key takeaways
The sync is decided one target at a time from a record each target keeps, and the source’s own definition of “safe to resume” is the only place a table’s history matters. That is why retention on the source side, not anything in XTable’s configuration, decides whether your runs stay incremental. The model is small on purpose, and it is also why some things never cross.
References
- Apache XTable architecture
- Apache XTable incremental sync
- Apache Hudi as an XTable source
- XTable source on GitHub
Trademarks
Apache XTable (incubating), Apache Hudi, Apache Iceberg, Apache Paimon, Apache Parquet and Apache are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries. Delta Lake is a trademark of the Linux Foundation. All other marks are the property of their respective owners.
Found this useful?
These posts and tools are free. If one saved you an afternoon, you can buy me a coffee.
Comments
Questions, corrections and reviews are welcome. Sign in with GitHub to post; comments are stored in this site's public GitHub Discussions.