All posts

Apache XTable in production: failure signals, retention, security

How to run XTable as a job you operate, from the source: architecture patterns, what each entry point does on failure, why nothing locks or retries, how long targets keep metadata, how to read sync freshness from XTABLE_METADATA, the REST service, and the threat model's rules for operators.

15 min read Lakehouse

TL;DR

XTable is a batch job you operate. It converts, records sync state in every target and reports a result per target. Scheduling, retrying, alerting and protecting files are yours.

  • Pick one writer. Everything else is a projection that is as fresh as the last sync.
  • The four entry points report failure differently: RunSync and RunCatalogSync exit 0 when a sync fails, the Spark CLI exits 1, and the service API returns a map you must check.
  • Nothing in XTable’s code locks, retries or backs off, so overlapping runs on one table are your scheduler’s problem.
  • Targets drop their own metadata after seven days, and that is not configurable from RunSync or the Spark runtime. The source’s cleaner is the retention that can break readers.
  • Every target carries an XTABLE_METADATA entry with the last synced instant. It is the cheapest freshness signal you have.
  • The project’s threat model puts security on the operator: no authentication on the service, no isolation, and a process that holds your storage credentials.

The earlier posts covered how a sync works, how to run it and what converts. This one is about operating it for a long time. Claims come from the 0.5.0-incubating source and from runs; the parts that are design guidance are marked as such.

XTable converts, records state, reports a result per target and trims target metadata after seven days, while you schedule, monitor, decide what a failure means and protect the source files

Architecture patterns

These are design guidance, drawn from what the code allows. None was load tested.

One writer, many readers. Choose the writer format first, because that is what decides what survives. A Hudi writer with Iceberg and Delta readers is the most common shape. It converts a Copy-on-Write table in full and a Merge-on-Read table as its read-optimized view. An Iceberg writer keeps every partition transform and reaches Hudi and Delta, with the limits in the compatibility post. A Delta writer is the narrow case where UniForm is worth checking first, as the decision guide explains.

Two writers in different formats is the pattern to avoid. The tool has no shared concurrency control across metadata trees, so a second writer can leave the targets describing files that no longer match.

Iceberg source with a Hudi index. The Hudi target holds the secondary index for Spark point lookups, as in the index post.

Several catalogs. RunCatalogSync registers each target in every listed catalog, and each catalog is its own failure domain, per the catalog post.

Many tables. RunSync and XTableSparkSync walk the datasets in a plain loop, one at a time. For hundreds of tables, split them into groups by owner, schedule and storage location, and run one process per group. One table failing does not stop the others in its group.

Air-gapped and on-premises. The project publishes no jar or container image, so you build from source, as the threat model notes. Verify the release signature, build on a trusted machine, and carry the artifact in.

What each entry point does when a sync fails

This is the table to put on the wall, because the wrong signal means a failure nobody sees. All four rows were run:

Entry point A failed sync gives you What to check
RunSync Exit code 0, even for a wrong path or a partial failure The log for Sync failed for the following formats or Error running sync
RunCatalogSync Exit code 0, even with an unreachable metastore The log, and the catalog itself
XTableSparkSync Exit code 1 and N of M table sync(s) failed The exit code
XTableSyncService.sync A Map<String, SyncResult>, with an ERROR status per failed format The map. An empty map means nothing was new

A partial failure is normal, and both a success line and a failure line can appear in one run. The Spark CLI’s error message lists each failed target with its reason, which is the most useful of the four.

RunSync and RunCatalogSync exit 0 on failure, XTableSparkSync exits 1, and XTableSyncService returns a map of results

Nothing locks, nothing retries

A search of the API, core, utilities and Spark runtime code finds no retry, backoff or lock. A failed result carries a canRetryOnFailure flag, and nothing reads it. With no Iceberg catalog configured, the Iceberg target writes through HadoopTables, where no catalog arbitrates the commit, and the other targets take no lock either. Two things follow:

  • Serialise runs per table. Use max_active_runs=1 in Airflow, a lock in your own scheduler, or one process per table group. Two overlapping runs are not safe, and --continuousMode is single-threaded only within one process.
  • Retry from the outside. A repeat run resumes from the state each target recorded, and a run with nothing new returns an empty map and does nothing. That makes a blind retry after a failure safe in the sense that it starts where the last success ended. Use backoff in the orchestrator and cap the attempts.

Orchestration

Run the sync after the source commit, not on an unrelated timer, so a target is not newer or older than the commit it claims to describe. Three shapes work:

  • A step after the write, calling XTableSyncService and checking the map. The freshness gap is as small as the write itself.
  • A scheduled XTableSparkSync, with the exit code as the signal.
  • RunSync --continuousMode for a changing list of tables. It reloads its config on every pass, and you must still read its log.

An Airflow DAG for the second shape, with overlap blocked and retries in the orchestrator. It follows Airflow’s standard operator and was not run for this series:

from datetime import datetime, timedelta
from airflow import DAG
from airflow.providers.apache.spark.operators.spark_submit import SparkSubmitOperator

with DAG(
    "xtable_trips_sync",
    schedule_interval="*/15 * * * *",
    start_date=datetime(2026, 1, 1),
    catchup=False,
    max_active_runs=1,
    default_args={"retries": 2, "retry_delay": timedelta(minutes=2)},
) as dag:
    SparkSubmitOperator(
        task_id="sync_trips",
        application="/opt/xtable/xtable-spark-runtime_2.12-0.5.0-incubating.jar",
        java_class="org.apache.xtable.spark.XTableSparkSync",
        packages="org.apache.hudi:hudi-spark3.5-bundle_2.12:1.2.1,org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.9.2,io.delta:delta-spark_2.12:3.3.2,io.delta:delta-kernel-api:4.0.0,io.delta:delta-kernel-defaults:4.0.0",
        application_args=["--basepath", "s3a://lakehouse-prod/warehouse/trips",
                          "--sourceformat", "HUDI", "--targets", "ICEBERG,DELTA",
                          "--partitionspec", "city_id:VALUE"],
    )

Retention and lifecycle

Two retentions matter, and they pull in different directions.

Three clocks: the source cleaner window, your sync lag and the target's seven-day metadata retention

The source’s own cleaning decides whether the next run stays incremental and whether a lagging target lists files that still exist. The Hudi cleaner, Iceberg snapshot expiry and Paimon snapshot expiry each feed isIncrementalSyncSafeFrom, as the sync internals post lists, and the Hudi source post shows the failure. Keep source retention longer than any sync lag you can imagine having, including an outage.

The target’s metadata retention is fixed. TargetTable defaults it to seven days, and there is a NO_METADATA_EXPIRY constant, but neither RunSync nor the Spark runtime passes a value. Each target then trims its own history:

Target What the code does with the seven days
Iceberg expireSnapshots().expireOlderThan(now minus retention)
Delta Sets the log retention to that many hours. It does not touch data files
Hudi Uses it as the timeline retention in hours

So time travel on a converted table reaches back a week, whatever the source keeps. Plan around that, or run XTable as a library and build the TargetTable yourself.

Monitoring

Every target carries the sync state. In the lab table, the Delta target’s table properties and the Iceberg target’s table properties and last snapshot summary all held the same entry:

XTABLE_METADATA = {"lastInstantSynced":"2026-12-04T13:22:08.468Z","instantsToConsiderForNextSync":[],
  "version":0,"sourceTableFormat":"HUDI","sourceIdentifier":"20261204132157801", ...}

lastInstantSynced is the source commit’s time, so comparing it with the source’s latest commit gives the lag per target, with no log scraping. These are the signals worth alerting on. They are suggestions, not defaults the tool emits:

Signal Source Suggested alert
Lag between the source’s latest commit and each target’s lastInstantSynced XTABLE_METADATA More than twice the sync interval
A failure line, or a non-zero exit from the Spark CLI Log, exit code Any
A snapshot pass where you expected an incremental one No previous InternalTable sync or Incremental sync is not safe in the log Repeated occurrences
Row counts of source and each target The comparison in the Hudi source post Any mismatch
Catalog registration The catalog itself A table missing or at the wrong location

Lag is the difference between the source's latest commit and the lastInstantSynced recorded in each target, with an alert at twice the sync interval

Performance and cost

Sync cost grows with the number of files and commits the source has to read, not with the number of rows. A snapshot pass reads the whole current file set, so repeated fallbacks are the expensive failure mode, and an incremental pass replays one target commit per source commit. The secondary index build is the exception, because it reads every data file. Nothing here was measured, so use these as the things to watch:

  • The count of snapshot passes per day.
  • Source commits per sync interval, which sets how many target commits one run writes.
  • Object-store requests, which scale with files, not data size.

Syncing more often than commits arrive adds cost without adding freshness.

Security and governance

THREAT_MODEL.md in the repository is explicit, and the operator’s side of it is this:

  • The service has no authentication or authorization. Keep it on loopback or a controlled network, and put your own authentication in front of it if you expose it.
  • There is no isolation between a caller and the credentials the XTable process holds, no multi-tenancy, and no bound on the time, memory or I/O a conversion may use.
  • A class named in configuration is instantiated. Treat config files as trusted code.
  • Converted tables can reference files outside the source table’s base path, by design.
  • Grant the process only the storage and catalog permissions it needs. Converted metadata is written into the table path, so that includes write access there, and it should not include read access to data the table’s writers must not see.
  • Convert tables from storage you trust, or run in an isolated environment, and keep the project current.

For governance, remember that a converted table exposes the schema and file statistics of the source to every reader of the target, and that each catalog you register in has its own access control.

Disaster recovery

This is guidance, and the rebuild paths were not run. A target is derived, so the source is the recovery point:

  • Lost or damaged target metadata. Remove the target’s metadata directory and sync again. With no XTABLE_METADATA the controller takes a snapshot pass. Try it on a copy first.
  • Stale target. Run a sync. If history is gone, the run falls back to a snapshot by itself.
  • Missing data files. Nothing in XTable restores them. That is the source’s backup and replication problem, and targets list the same files.
  • Catalog registration lost. Run RunCatalogSync again. It creates what is missing.

The REST service

XTable ships a REST service, and it is the least finished part of the project. xtable-service is published on Maven Central at 0.5.0-incubating. Its own README calls it a developer utility, and the project’s THREAT_MODEL.md says the same: no authentication or authorization, and in Quarkus production mode it listens on all interfaces unless quarkus.http.host is set. Run it on loopback or inside a network you control.

Three things differ from the OpenAPI file in spec/rest-service-open-api.yaml (version 0.0.1), which describes two operations:

In the spec What 0.5.0 did
POST /v1/conversion/table returning conversions Returned 200 with the result under convertedTables
Prefer: respond-async giving 202 and a conversion-id The header made no difference: the call still ran to completion and returned 200
GET /v1/conversion/table/{conversion-id} to poll The route answered 404; the resource class has only the POST

And the request needs a field the spec does not list. source-data-path is required, because the service builds each target from it, and leaving it out fails with NullPointerException: basePath is marked non-null but is null:

curl -s -X POST localhost:8080/v1/conversion/table -H 'Content-Type: application/json' -d '{
  "source-format": "HUDI",
  "source-table-name": "trips",
  "source-table-path": "file:///tmp/lakehouse/trips",
  "source-data-path": "file:///tmp/lakehouse/trips",
  "target-formats": ["ICEBERG"],
  "configurations": {"partition-spec": "city_id:VALUE"}
}'

The response carries target-format, target-metadata-path (here .../metadata/v3.metadata.json) and target-schema for each target.

Running it took two workarounds. The packaged quarkus-app starts but the first request fails with NoClassDefFoundError: org/apache/hadoop/conf/Configuration, because Hadoop is not in that package. Start it the way the README says, with ./mvnw quarkus:dev -pl xtable-service, which listens on port 8080. On Java 17 Spark also needs module options, passed as -Djvm.args="--add-exports=java.base/sun.nio.ch=ALL-UNNAMED ...", or the call fails with IllegalAccessError on sun.nio.ch.DirectBuffer. A request for a DELTA target still failed with NoClassDefFoundError: org/apache/spark/sql/delta/actions/Action, so only the Iceberg target is confirmed. The service converts Hudi, Iceberg and Delta sources; it has no Paimon or Parquet source. Pin whatever you build against it.

Which engines can read the result

Once the metadata is written, this stops being an XTable question. A converted table is an ordinary table of that format, and the project says so plainly: synced tables “behave the similarly to native tables which means you do not need any additional configurations on query engines’ side”.

These are the engines the project documents, and the formats each page covers:

Engine Formats covered by its page
Apache Spark Hudi, Iceberg, Delta
Trino Hudi, Iceberg, Delta
Presto Hudi, Iceberg, Delta
Amazon Athena Hudi, Iceberg, Delta
Amazon Redshift Spectrum Hudi, Iceberg, Delta
Google BigQuery Hudi, Iceberg, Delta
Microsoft Fabric Hudi, Iceberg, Delta
StarRocks Hudi, Iceberg, Delta
Snowflake Iceberg only

Spark read all three formats of the same directory in this check, and Trino read the Iceberg table registered through the metastore. The other engines are the project’s documentation and are untested.

0.5.0 also documents registering synced tables in four catalogs, each with its own page: Hive Metastore, AWS Glue, Unity Catalog (Databricks and the open-source server) and BigLake Metastore. Snowflake is the one engine whose page covers Iceberg only, which is the case XTable exists for: the warehouse dictates the format, and your ingestion pipeline keeps writing the format it already uses. Check the engine docs for current, engine-specific instructions before you commit to one.

Check each engine, not only Spark

Three layers decide whether a reader sees the table, and a pass in one says little about the others:

Layer Question How to check
XTable Did the target metadata describe the same table? The comparison in the Hudi source post, and the controller log
Catalog Does the engine resolve the table to the current metadata? Query by name, then register again after a sync that changed the location
Engine Can this engine read the format version, types and features? Run the same queries in that engine

Run these in every engine that will read the target:

  • A row count and a filtered count, compared with the source.
  • A query that filters on a partition column.
  • A query that selects a nested or decimal column, if the table has one.
  • A query after the next source commit and sync, so you see the incremental path and not only the first load.
  • A query after the source’s cleaner has run, as in the Hudi source post.

Spark read all three formats of the same directory in the checks for this page, and Trino read the Iceberg table registered through the metastore. That does not extend to Athena, Snowflake or BigQuery, which were not run. Engine requirements also differ: Iceberg 1.11 and later needs Java 17, and a version 9 Hudi target needs Hudi 1.1.0 or later to read.

Production readiness checklist

  • One writer is named for every table, and nothing else writes.
  • The scheduler serialises runs per table, and retries are capped.
  • The signal for failure is the right one for the entry point you use.
  • Source retention is longer than the longest sync outage you would tolerate.
  • An alert exists on the lag read from XTABLE_METADATA.
  • Counts across formats are compared after any change to the table.
  • The process has write access to the table path and nothing more, and the service is not exposed.
  • The Hive jars, the Hudi Java client and the Delta Kernel jars are on the classpath where needed.
  • You know which Delta implementation you run, because the Kernel target cannot convert time or bucket partitions and cannot evolve an existing table’s schema.

Checked against the source

Claim Where
Exit behaviour of the four entry points RunSync, RunCatalogSync, XTableSparkSync.syncAll, XTableSyncService, plus runs
No retry, backoff or lock; canRetryOnFailure A search of xtable-api, xtable-core, xtable-utilities and xtable-spark-runtime, and ErrorDetails
Seven-day default and NO_METADATA_EXPIRY TargetTable
Iceberg, Delta and Hudi use of the retention IcebergConversionTarget, DeltaConversionTarget, HudiConversionTarget
XTABLE_METADATA TableSyncMetadata, and read from real targets
Sequential dataset loop RunSync.syncTableMetdata, XTableSparkSync.syncAll
Security properties and operator duties THREAT_MODEL.md
REST service endpoints ConversionResource

The exit codes, the XTABLE_METADATA reads and the REST behaviour are from runs. The patterns, the disaster recovery steps and the Airflow DAG are guidance and were not run.

Key takeaways

Production XTable is a short list of things you supply. Name one writer, make the failure signal explicit for the entry point you chose, keep runs from overlapping, keep the source’s retention longer than your worst lag, and read freshness from the sync state each target already records. The tool will report what it did. It will not lock, retry or alert for you.

References

Trademarks

Apache XTable (incubating), Apache Hudi, Apache Iceberg, Apache Spark, Apache Airflow, Apache Hive 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.

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.