apache/cassandra · warning

Unable to delete storage-attached index component file {} du

Error message

Unable to delete storage-attached index component file {} due to {}.

What it means

IndexDescriptor.deleteComponent deletes an SAI per-component file (e.g. a per-column index segment, metadata, or checksum file) with IOUtils.deleteFilesIfExist. If the delete fails with an IOException (file locked, permission denied, FS error), the code logs a warning including the IOException message instead of throwing, because index cleanup is best-effort. Leftover files are orphaned but harmless since the SSTable descriptor tracks live components.

Source

Thrown at src/java/org/apache/cassandra/index/sai/disk/format/IndexDescriptor.java:490

    {
        return version.onDiskFormat()
                      .perColumnIndexComponents(indexTermType)
                      .stream()
                      .map(c -> fileFor(c, indexIdentifier))
                      .filter(File::exists)
                      .count();
    }

    private void deleteComponent(File file)
    {
        logger.debug(logMessage("Deleting storage-attached index component file {}"), file);
        try
        {
            IOUtils.deleteFilesIfExist(file.toPath());
        }
        catch (IOException e)
        {
            logger.warn(logMessage("Unable to delete storage-attached index component file {} due to {}."), file, e.getMessage(), e);
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Check filesystem permissions and free space on the data directory where the component file lives.
  2. On Windows, ensure all Cassandra threads using the file have finished before removal, or configure cassandra.yaml file_cache / mmap settings to non-mmap (disk_access_mode: standard) to avoid lingering mapped handles.
  3. Manually remove orphaned component files that match the SSTable descriptor pattern once the SSTable is no longer live.
  4. Check disk health (dmesg / smartctl) if the IOException message indicates an I/O error.

Example fix

// before: adjusting platform to avoid locked deletes on Windows
cassandra.yaml: disk_access_mode: mmap
// after
cassandra.yaml: disk_access_mode: standard
Defensive patterns

Strategy: validation

Validate before calling

// before component deletion
dir = file.getParent().toFile();
if (!dir.canWrite()) logger.warn("Index dir not writable: " + dir);

Try / catch

// deleteComponent already swallows IOException; wrap bulk cleanup
try { descriptor.deleteAllComponents(); }
catch (Throwable t) { logger.warn("Cleanup incomplete, orphan files possible", t); }

Prevention

When it happens

Trigger: Deleting index files during index drop, SSTable removal, or abort of an index writer while the file is still memory-mapped/open by another thread (Windows file locking) or the directory has wrong permissions; disk I/O errors during cleanup.

Common situations: Dropping a SAI index on Windows while readers still hold files open; read-only or quota-exceeded volume after a crash; concurrent abort and delete paths racing on the same component files.

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/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/108494fb2c32661f. Report an issue: GitHub.