Table repair feature
The repair_metadata() function provides a self-service recovery path to
recover Iceberg tables that are inaccessible due to missing data files after manual file deletions
in the underlying storage.
To maintain table integrity, you must always interact with Iceberg tables through the engine or
the Iceberg API. For example, to remove partitions, you must use the DROP
PARTITION statement instead of manually deleting directories from the file system, for
example, S3, ADLS, or HDFS).
Impala can repair the table only if the missing files are data files. Impala cannot repair the
table if there are missing delete files. If delete files are missing, the
repair_metadata() function does not remove references to those files, and the
table remains inaccessible.
When you delete files directly from the storage without updating the Iceberg metadata, the table becomes corrupted, causing the subsequent queries to fail with the following error message: Iceberg table [...] cannot be fully loaded due to unavailable files
This issue occurs because the Iceberg manifest files still contain references to data files that no longer exist. If you cannot restore the missing files from a backup or filesystem trash, you can use the command. The following command synchronizes the metadata by removing references to the missing data files, making the table functional again:
Impala example
ALTER TABLE ice_tbl EXECUTE repair_metadata();
