{"record":{"id":"ad94b6e8e078d6b5","repo":"apache/druid","slug":"could-not-perform-task-action-retrieveupgradedtose","errorCode":null,"errorMessage":"Could not perform task action[retrieveUpgradedToSegmentIds] to retrieve segment IDs which share load specs with segments being killed. Stopping kill task to avoid data loss in case the segment files are shared by other segments.","messagePattern":"Could not perform task action\\[retrieveUpgradedToSegmentIds\\] to retrieve segment IDs which share load specs with segments being killed\\. Stopping kill task to avoid data loss in case the segment files are shared by other segments\\.","errorType":"exception","errorClass":"ISE","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/common/task/KillUnusedSegmentsTask.java","lineNumber":497,"sourceCode":"      );\n      if (response != null && response.getUpgradedToSegmentIds() != null) {\n        response.getUpgradedToSegmentIds().forEach((parent, children) -> {\n          if (!unusedSegments.keySet().containsAll(children)) {\n            // Do not kill segment if its load spec is shared by another segment\n            // which is not being killed.\n            LOG.info(\n                \"Skipping kill of segments[%s] as its load spec is shared by segment IDs[%s].\",\n                parentIdToUnusedSegments.get(parent), children\n            );\n            parentIdToUnusedSegments.remove(parent);\n          }\n        });\n      }\n    }\n    catch (Exception e) {\n      // Do not proceed with the kill of any segment as we cannot be sure if their\n      // load specs are shared by any other segment\n      throw new ISE(\n          e,\n          \"Could not perform task action[retrieveUpgradedToSegmentIds] to retrieve\"\n          + \" segment IDs which share load specs with segments being killed.\"\n          + \" Stopping kill task to avoid data loss in case the segment files\"\n          + \" are shared by other segments.\"\n      );\n    }\n\n    // Filter using the used segment load specs as segment upgrades predate the above task action\n    return parentIdToUnusedSegments.values()\n                                   .stream()\n                                   .flatMap(Set::stream)\n                                   .filter(segment -> !isSegmentLoadSpecPresentIn(segment, usedSegmentLoadSpecs))\n                                   .collect(Collectors.toList());\n  }\n\n  /**\n   * @return true if the load spec of the segment is present in the given set of","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/common/task/KillUnusedSegmentsTask.java#L479-L515","documentation":"Analogous to the upgraded-from check: before killing segments the task queries which other segments share load specs with the victims (retrieveUpgradedToSegmentIds). Any exception from this task action aborts the kill, because deleting shared segment files would lose data for surviving segments.","triggerScenarios":"The retrieveUpgradedToSegmentIds action throws during getKillableSegments — metadata store errors, action timeouts, connectivity failure to the Overlord — while computing segmentsToKillFromDeepStore.","commonSituations":"Metadata store outage or replication lag; oversized kill ranges causing long-running actions; overlord restart mid-action; version mismatch between overlord and task after an upgrade.","solutions":["Restore metadata store health / fix connectivity, then resubmit the kill task","Reduce the kill interval or segment limit to shrink the action's work","Upgrade/restart overlord and middle managers to matching versions if the failure began after an upgrade"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { killTask.submit(); } catch (ISE e) { if (e.getMessage().contains(\"retrieveUpgradedToSegmentIds\")) { scheduleRetryWithBackoff(e.getCause()); } else { throw e; } }","preventionTips":["Keep overlord and middle managers on matching versions","Limit kill task size to reduce action timeout risk","Alert on metadata store errors during maintenance windows"],"tags":["druid","kill-task","metadata-store","safety"],"backgroundTag":"database-query-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}