{"record":{"id":"592de4d59e305e46","repo":"apache/druid","slug":"s-592de4","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":"SegmentLoadingException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/loading/BroadcastJoinableMMappedQueryableSegmentizerFactory.java","lineNumber":77,"sourceCode":"\n  @Override\n  public Segment factorize(DataSegment dataSegment, File parentDir, boolean lazy, SegmentLazyLoadFailCallback loadFailed) throws SegmentLoadingException\n  {\n    try {\n      return new QueryableIndexSegment(indexIO.loadIndex(parentDir, lazy, loadFailed), dataSegment.getId()) {\n        @Nullable\n        @Override\n        public <T> T as(Class<T> clazz)\n        {\n          if (clazz.equals(IndexedTable.class)) {\n            return (T) new BroadcastSegmentIndexedTable(this, keyColumns, dataSegment.getVersion());\n          }\n          return super.as(clazz);\n        }\n      };\n    }\n    catch (IOException e) {\n      throw new SegmentLoadingException(e, \"%s\", e.getMessage());\n    }\n  }\n\n  @Override\n  public boolean equals(Object o)\n  {\n    if (this == o) {\n      return true;\n    }\n    if (o == null || getClass() != o.getClass()) {\n      return false;\n    }\n    BroadcastJoinableMMappedQueryableSegmentizerFactory that = (BroadcastJoinableMMappedQueryableSegmentizerFactory) o;\n    return Objects.equals(keyColumns, that.keyColumns);\n  }\n\n  @Override\n  public int hashCode()","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/loading/BroadcastJoinableMMappedQueryableSegmentizerFactory.java#L59-L95","documentation":"BroadcastJoinableMMappedQueryableSegmentizerFactory.factorize wraps any IOException encountered while mmapping/loading the segment files into a SegmentLoadingException whose message is the underlying IOException's message. It signals that the segment data on disk could not be read or mapped for broadcast join use.","triggerScenarios":"factorize(dataSegment, parentDir, ...) is called but the segment's index.zix/meta files are missing, unreadable, or fail during mmapping, causing an IOException from mapFile/SegmentFileSelector operations.","commonSituations":"Deep storage pull succeeded but local cache directory is corrupted or truncated; permissions changed on the segment directory; disk full during segment materialization; partially written segment after a crash.","solutions":["Check the segment directory exists and contains all segment files (meta.json, index.drd, etc.)","Fix filesystem permissions on the segment cache directory","Reload/re-download the segment by clearing the local segment cache for that segment","Inspect the cause chain of the SegmentLoadingException for the root IOException"],"exampleFix":"// before\n// silently retrying with corrupted cache dir\n// after\nif (!new File(parentDir, \"meta.json\").exists()) { segmentCacheManager.delete(segId); /* re-fetch */ }\nSegment seg = factory.factorize(dataSegment, parentDir, lazy, loadFailed);","handlingStrategy":"try-catch","validationCode":"File segDir = new File(parentDir, dataSegment.getId().toString()); if (!segDir.isDirectory() || !new File(segDir, \"meta.json\").exists()) { refetchSegment(dataSegment); }","typeGuard":"boolean segmentFilesPresent(File dir) { return dir != null && dir.isDirectory() && dir.listFiles() != null && dir.listFiles().length > 0; }","tryCatchPattern":"try { seg = factory.factorize(segment, dir, lazy, cb); } catch (SegmentLoadingException e) { log.error(e, \"Failed to load broadcast segment %s\", segment.getId()); cacheCleaner.cleanup(dir); throw e; }","preventionTips":["Monitor local segment cache health and disk usage","Re-download segments after abnormal broker/historical shutdowns","Keep Druid versions homogeneous across the cluster"],"tags":["segment-loading","io-exception","filesystem"],"backgroundTag":"file-read-failed","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"}