apache/iceberg · warning

Deleted only {} of {} file(s) ({})

Error message

Deleted only {} of {} file(s) ({})

What it means

After the retried bulk delete in SparkCleanupUtil, the count of successfully deleted files is compared to the requested paths; if some failed (their failures were suppressed), this warning reports how many were actually deleted. The streaming job continues; failed files remain on storage.

Source

Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkCleanupUtil.java:115

    Tasks.foreach(paths)
        .executeWith(ThreadPools.getWorkerPool())
        .stopRetryOn(NotFoundException.class)
        .suppressFailureWhenFinished()
        .onFailure((path, exc) -> LOG.warn("Failed to delete {} ({})", path, context, exc))
        .retry(DELETE_NUM_RETRIES)
        .exponentialBackoff(
            DELETE_MIN_RETRY_WAIT_MS,
            DELETE_MAX_RETRY_WAIT_MS,
            DELETE_TOTAL_RETRY_TIME_MS,
            2 /* exponential */)
        .run(
            path -> {
              io.deleteFile(path);
              deletedFilesCount.incrementAndGet();
            });

    if (deletedFilesCount.get() < paths.size()) {
      LOG.warn("Deleted only {} of {} file(s) ({})", deletedFilesCount, paths.size(), context);
    } else {
      LOG.info("Deleted {} file(s) ({})", paths.size(), context);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Cross-check remaining files against the cleanup context and delete manually if safe
  2. Avoid running expire_snapshots/remove_orphan_files concurrently with streaming cleanup on the same table
  3. Investigate per-file failures from the earlier 'Failed to delete' warnings
Defensive patterns

Strategy: retry

Validate before calling

// after cleanup: list leftover paths and compare against the failed set

Try / catch

long failed = totalPaths - deletedCount; if (failed > 0) { /* re-run delete or inspect 'Failed to delete' warnings */ }

Prevention

When it happens

Trigger: delete() completes with Tasks suppressing per-file failures, so at least one path's io.deleteFile failed after all retries.

Common situations: Intermittent cloud storage errors during high delete volume, or files concurrently removed by another process (expiration/orphan cleanup running simultaneously).

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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