apache/druid · error · SegmentLoadingException
Failed to rewrite info file for segment[%s] while releasing
Error message
Failed to rewrite info file for segment[%s] while releasing partial-load rule[fingerprint=%s]
What it means
When releasing a partial-load rule, SegmentLocalCacheManager rewrites the segment's info file so it no longer carries the rule-wrapped loadSpec. If the rewrite throws an IOException, it is wrapped in this SegmentLoadingException including the prior rule fingerprint.
Source
Thrown at server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java:1630
* clears the rule and removes the info file, so there is no stale rule for a restart to reinstate. Leaving the rule
* applied and carrying on is not an option, because an unwrapped request announces as a full load either way, so the
* coordinator would record a replica with no profile and never ask again.
* <p>
* Callers must hold this segment's {@link #lock(DataSegment)}, which is the external lock that
* {@link PartialSegmentMetadataCacheEntry#clearRule} requires to be serialized against
* {@link PartialSegmentMetadataCacheEntry#applyRule}.
*/
private void releaseRuleForFullLoad(DataSegment dataSegment, PartialSegmentMetadataCacheEntry partial)
throws SegmentLoadingException
{
// Snapshot both before clearRule zeroes out the rule state so the log can describe what was released.
final String priorFingerprint = partial.getRuleFingerprint();
final long priorRealizedBytes = partial.getRealizedBytes();
try {
rewriteInfoFile(dataSegment);
}
catch (IOException e) {
throw new SegmentLoadingException(
e,
"Failed to rewrite info file for segment[%s] while releasing partial-load rule[fingerprint=%s]",
dataSegment.getId(),
priorFingerprint
);
}
partial.clearRule();
log.info(
"Released partial-load rule[fingerprint=%s, realizedBytes=%d] for segment[%s]; it is a regular full load now.",
priorFingerprint,
priorRealizedBytes,
dataSegment.getId()
);
}
/**
* Whether any location already has a cache entry for {@code id}
*/View on GitHub (pinned to 9b90983fd2)
Solutions
- Check disk space and permissions on the cache location and repair the underlying write failure.
- Ensure no external processes delete or modify the segment cache info-hierarchy while the historical runs.
- After fixing, retry the rule release or restart the historical so it reconciles info files with in-memory state.
- Investigate concurrent eviction/drop operations targeting the same segment id.
Defensive patterns
Strategy: try-catch
Validate before calling
final File infoFile = infoHierarchy.fileFor(dataSegment.getId());
if (!infoFile.canWrite() || infoFile.getParentFile().getUsableSpace() < MIN_FREE_BYTES) {
throw new IllegalStateException("Cannot rewrite info file for rule release: " + infoFile);
} Try / catch
try {
cacheManager.releasePartialLoadRule(segment);
} catch (SegmentLoadingException e) {
if (e.getMessage() != null && e.getMessage().contains("releasing partial-load rule")) {
alertDiskProblem(e); // rule state may be inconsistent; repair disk then restart/reconcile
} else {
throw e;
}
} Prevention
- Monitor cache-location disk space so rule-release rewrites don't fail.
- Never externally delete or modify the info-hierarchy while the historical runs.
- Handle concurrent drop/eviction of the same segment id carefully.
- If release fails, restart the historical to reconcile in-memory rule state with on-disk info files.
When it happens
Trigger: Rule release path calls rewriteInfoFile(dataSegment) and the file write fails — disk full, read-only filesystem, missing info-hierarchy directory, or the file was removed concurrently.
Common situations: Cache disk full when dropping a partial-load rule; cache directory cleaned by external tooling while the historical holds state; permissions issues; races between rule release and cache eviction.
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
- Exception during serialization of lookups using file [%s]
- Failed to write to file: %s. Current size of file: %d
- Failed to write to file: %s. Current size of file: %d
- Failed to write partial info file for segment[%s]
- Failed to mount partial metadata for segment[%s]
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/117ae42ed0d2a94f.
Report an issue: GitHub.