apache/iceberg · error · UnsupportedOperationException

Dropping a backup is not supported

Error message

Dropping a backup is not supported

What it means

MigrateTable's default dropBackup() method throws UnsupportedOperationException when the action implementation does not support dropping the backup of the original table after a successful migration. Migration backups keep the source table accessible; not all implementations allow programmatic backup removal.

Source

Thrown at api/src/main/java/org/apache/iceberg/actions/MigrateTable.java:51

  MigrateTable tableProperties(Map<String, String> properties);

  /**
   * Sets a table property in the newly created Iceberg table. Any properties with the same key will
   * be overwritten.
   *
   * @param name a table property name
   * @param value a table property value
   * @return this for method chaining
   */
  MigrateTable tableProperty(String name, String value);

  /**
   * Drops the backup of the original table after a successful migration
   *
   * @return this for method chaining
   */
  default MigrateTable dropBackup() {
    throw new UnsupportedOperationException("Dropping a backup is not supported");
  }

  /**
   * Sets a table name for the backup of the original table.
   *
   * @param tableName the table name for backup
   * @return this for method chaining
   */
  default MigrateTable backupTableName(String tableName) {
    throw new UnsupportedOperationException("Backup table name cannot be specified");
  }

  /**
   * Sets the executor service to use for parallel file reading. The default is not using executor
   * service.
   *
   * @param service executor service
   * @return this for method chaining

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade the engine integration to a version whose MigrateTable implementation supports dropBackup.
  2. Drop the backup manually via the catalog (e.g., catalog.dropTable(backupTableName)) instead of using dropBackup().
  3. Override dropBackup in a custom MigrateTable implementation.

Example fix

// before
MigrateTable m = SparkActions.get().migrateTable(table).dropBackup(); // throws on old impl
// after (manual cleanup via catalog)
SparkActions.get().migrateTable(table).execute();
catalog.dropTable(backupIdent);
Defensive patterns

Strategy: try-catch

Validate before calling

boolean ok = Arrays.stream(migrate.getClass().getMethods()).anyMatch(m -> "dropBackup".equals(m.getName()) && m.getDeclaringClass() != MigrateTable.class);

Type guard

boolean implemented = migrate.getClass() != MigrateTable.class;

Try / catch

try { migrate = migrate.dropBackup(); } catch (UnsupportedOperationException e) { catalog.dropTable(backupIdent); }

Prevention

When it happens

Trigger: Calling migrateTable(...).dropBackup() on an implementation that has not overridden the method — e.g., older engine runtimes or custom MigrateTable actions.

Common situations: Automating migration cleanup (removing the backup table of the pre-migration source) with a runtime lacking support; following newer documentation against an older Iceberg version.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/f859b6faab5fc601. Report an issue: GitHub.