{"record":{"id":"ad579beeaa426fc2","repo":"apache/druid","slug":"location-s-with-available-bytes-d-cannot-rese","errorCode":null,"errorMessage":"Location[%s] with available bytes[%,d] cannot reserve segment[%s] of size[%,d] during bootstrap; check druid.segmentCache.locations maxSize","messagePattern":"Location\\[(.+?)\\] with available bytes\\[%,d\\] cannot reserve segment\\[(.+?)\\] of size\\[%,d\\] during bootstrap; check druid\\.segmentCache\\.locations maxSize","errorType":"exception","errorClass":"SegmentLoadingException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java","lineNumber":1760,"sourceCode":"  private StorageLocation.ReservationHold<SegmentCacheEntry> reserveCompleteForBootstrap(\n      DataSegment dataSegment,\n      SegmentCacheEntryIdentifier id\n  ) throws SegmentLoadingException\n  {\n    if (isRegisteredAtAnyLocation(id)) {\n      return null;\n    }\n    for (StorageLocation location : locations) {\n      final CacheEntry cacheEntry = new CompleteSegmentCacheEntry(dataSegment);\n      if (!((CompleteSegmentCacheEntry) cacheEntry).checkExists(location.getPath())) {\n        continue;\n      }\n      final StorageLocation.ReservationHold<SegmentCacheEntry> hold = location.addWeakReservationHold(\n          id,\n          () -> new CompleteSegmentCacheEntry(dataSegment)\n      );\n      if (hold == null) {\n        throw new SegmentLoadingException(\n            \"Location[%s] with available bytes[%,d] cannot reserve segment[%s] of size[%,d] during bootstrap; check \"\n            + \"druid.segmentCache.locations maxSize\",\n            location.getPath(),\n            location.availableSizeBytes(),\n            dataSegment.getId(),\n            dataSegment.getSize()\n        );\n      }\n      return hold;\n    }\n    return null;\n  }\n\n  /**\n   * Reapply the persisted partial-load rule to a bootstrap-restored metadata entry. Reads the wrapper from the\n   * segment's info-file {@code loadSpec}, resolves the selected bundle names against the just-parsed on-disk\n   * metadata header, calls {@link PartialSegmentMetadataCacheEntry#applyRule}, then drives eager downloads for any\n   * selected bundle that wasn't restored from disk (via {@link #awaitEagerDownloadsOrClearRule}). On failure the","sourceCodeStart":1742,"sourceCodeEnd":1778,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java#L1742-L1778","documentation":"Thrown by reserveCompleteForBootstrap when an on-disk complete segment exists but location.addWeakReservationHold returns null because the location's available bytes are less than the segment size. Bootstrap previously mounted such segments unreserved (under-counting disk usage); it now fails fast and directs the operator at druid.segmentCache.locations maxSize.","triggerScenarios":"During bootstrap, a complete segment directory exists on a location whose availableSizeBytes is smaller than dataSegment.getSize(), so addWeakReservationHold cannot admit it.","commonSituations":"maxSize configured lower than the data already present in the cache directory (config reduced after cache grew); miscounting after crash/restart; shared or resized volumes.","solutions":["Raise druid.segmentCache.locations maxSize to at least the total size of existing cached segments.","Alternatively clear the cache directory so on-disk content fits the configured maxSize and re-downloads.","Verify location.freeSizeBytes/available bytes accounting; delete stale segment info files if accounting is corrupted.","Ensure the sum of segment sizes on disk matches what the location tracker expects after unclean shutdowns."],"exampleFix":"// before: maxSize smaller than existing cache\ndruid.segmentCache.locations=[{\"path\":\"/var/druid/segment-cache\",\"maxSize\":5000000000}]\n// after\ndruid.segmentCache.locations=[{\"path\":\"/var/druid/segment-cache\",\"maxSize\":100000000000}]","handlingStrategy":"validation","validationCode":"// pre-start check: sum of existing segment files must fit under maxSize\nlong used = duCacheDir(cachePath);\nif (used > maxSize) { throw new IllegalStateException(\"Increase druid.segmentCache.locations maxSize to >= \" + used); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never lower maxSize below the current on-disk cache size; resize config and disk together.","Monitor availableSizeBytes per location and alert before exhaustion.","After unclean shutdowns, reconcile on-disk usage against configured maxSize before restart."],"tags":["segment-cache","bootstrap","disk-capacity","maxsize"],"backgroundTag":"invalid-config-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}