Skip to content

Fix expireSnapshots fails with IllegalArgumentException on object-store-backed tables#4259

Open
felixhzhu wants to merge 1 commit into
apache:masterfrom
felixhzhu:fix-expire-snapshots-object-store
Open

Fix expireSnapshots fails with IllegalArgumentException on object-store-backed tables#4259
felixhzhu wants to merge 1 commit into
apache:masterfrom
felixhzhu:fix-expire-snapshots-object-store

Conversation

@felixhzhu

Copy link
Copy Markdown

What changes were proposed in this pull request?

Fix expireSnapshots task failing with IllegalArgumentException: null when the
underlying FileIO is an object store (S3FileIO / OSSFileIO / GCSFileIO / ResolvingFileIO).

Root Cause

RollingFileCleaner.doCleanFiles() unconditionally calls TableFileUtil.deleteEmptyDirectory(),
which calls io.asFileSystemIO(). For object-store FileIO implementations,
supportFileSystemOperations() returns false, causing Preconditions.checkArgument()
to throw IllegalArgumentException: null.

"Delete empty parent directory" is only meaningful for HDFS/Hadoop FS semantics — object
stores have no real directory concept.

Fix

  1. TableFileUtil.deleteEmptyDirectory(): Add early-return when !io.supportFileSystemOperations()
  2. RollingFileCleaner.doCleanFiles():
    • Guard the parent directory cleanup loop with supportFileSystemOperations() check
    • Catch per-directory exceptions as WARN to avoid interrupting the entire batch
    • Move parentDirectories.clear() and collectedFiles.clear() into finally block

No schema / config / API signature changes. HDFS tables are completely unaffected.

How was this patch tested?

  • Verified on production environment with S3FileIO (Tencent Cloud COS)
  • Confirmed HDFS-backed tables still clean empty directories correctly
  • No regression in existing expireSnapshots flows

fix #4237

…xception on object-store-backed tables

When the underlying FileIO is an object store (S3FileIO/OSSFileIO/GCSFileIO), deleteEmptyDirectory() calls asFileSystemIO() which throws IllegalArgumentException because supportFileSystemOperations() returns false.

Fix: 1) Add early-return in TableFileUtil.deleteEmptyDirectory() when !supportFileSystemOperations() 2) Guard the parent directory cleanup loop in RollingFileCleaner with supportFileSystemOperations() check 3) Move buffer clear() into finally block to prevent re-submission on failure

fix apache#4237
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant