apache/druid · error · ISE
Could not retrieve parent segment ids using task…
Error message
Could not retrieve parent segment ids using task action[retrieveUpgradedFromSegmentIds]. Stopping kill task to avoid data loss in case the segment files are shared by other segments.
What it means
Before killing segments from deep storage, the task must know each segment's parent (upgraded-from) segment IDs via the retrieveUpgradedFromSegmentIds task action, because replacement segments can share load specs/files. If the action call fails for any reason, the kill aborts deliberately to avoid deleting files still referenced by other segments.
Solutions
- Check metadata store connectivity/health and retry the kill task once the DB is reachable
- Split the kill into smaller intervals/batches to reduce action payload and timeout risk
- Inspect the underlying cause exception (attached to this ISE) and fix that failure first
Defensive patterns
Strategy: retry
Validate before calling
// pre-check metadata store reachability before submitting kill dbHealth = dataSource.getConnection().isValid(5);
Try / catch
try { killTask.submit(); } catch (ISE e) { if (e.getMessage().contains("retrieveUpgradedFromSegmentIds")) { scheduleRetryWithBackoff(e.getCause()); } else { throw e; } } Prevention
- Monitor metadata store health before running kill jobs
- Split kills into smaller interval batches
- Always read the attached cause exception to fix the root failure first
When it happens
Trigger: The retrieveUpgradedFromSegmentIds task action throws — metadata store outage, action client failure, timeout talking to the coordinator/overlord, or schema/serialization issues — while fetchParentIdsForSegments prepares the kill set.
Common situations: Metadata store (MySQL/PostgreSQL) temporarily down or saturated; network partition between middle manager and overlord during kill; very large kill sets making the action slow and timing out.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Could not perform task action[retrieveUpgradedToSegmentIds]…
- Locks[ ] for task[ ] can't cover segments[ ]
- A-Not-B requires at least 1 sketch
- Access-Check-Result
- Action [ ] failed for worker [ ] with status ( )
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/9b57d5e7f01e00e0.
Report an issue: GitHub.
Appendix: source
Thrown at indexing-service/src/main/java/org/apache/druid/indexing/common/task/KillUnusedSegmentsTask.java:418
* it does not have an entry in the map.
*/
protected Map<String, String> fetchParentIdsForSegments(
TaskToolbox toolbox,
Map<String, DataSegmentPlus> unusedIdToSegmentPlus
)
{
try {
return toolbox.getTaskActionClient().submit(
new RetrieveUpgradedFromSegmentIdsAction(getDataSource(), unusedIdToSegmentPlus.keySet())
).getUpgradedFromSegmentIds();
}
catch (Exception e) {
// Do not proceed with killing these segments as we cannot be sure if their
// load spec is shared by any other segment or not. If load spec is shared,
// segment files cannot be deleted from deep store. If load spec is not
// shared, segments cannot be deleted from metadata store as that would
// leave deep store files orphaned, and they would never be cleaned up.
throw new ISE(
e,
"Could not retrieve parent segment ids using task action[retrieveUpgradedFromSegmentIds]."
+ " Stopping kill task to avoid data loss in case the segment files"
+ " are shared by other segments."
);
}
}
/**
* Logs the given info message. Exposed here to allow embedded kill tasks to
* suppress info logs.
*/
protected void logInfo(String message, Object... args)
{
LOG.info(message, args);
}
private NavigableMap<DateTime, List<TaskLock>> getNonRevokedTaskLockMap(TaskActionClient client) throws IOExceptionView on GitHub (pinned to 9b90983fd2)