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
- Check filesystem permissions and free space on the data directory where the component file lives.
- 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.
- Manually remove orphaned component files that match the SSTable descriptor pattern once the SSTable is no longer live.
- 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
- Ensure the Cassandra process user owns the data directories and they are writable.
- On Windows, avoid mmap (disk_access_mode: standard) to reduce locked-file deletes.
- Monitor free disk space so deletes don't fail on quota/ENOSPC.
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
- Failed to remove hard link files
- Exception thrown when cleaning up files to delete on exit, c
- Failed importing SSTables
- Unable to resolve canonical path for
- FSReadError
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/108494fb2c32661f.
Report an issue: GitHub.