server/src/main/java/org/apache/druid/server/coordination/SegmentLoadDropHandler.java
/**
   * Load a single segment. If the segment is loaded successfully, this function simply returns. Otherwise it will
   * throw a SegmentLoadingException
   *
   * @throws SegmentLoadingException if it fails to load the given segment
   */
Load a single segment. If the segment is loaded successfully, this function simply returns. Otherwise it will
throw a SegmentLoadingException

@throws SegmentLoadingException if it fails to load the given segment
Load a single segment . If the segment is loaded successfully this function simply returns . Otherwise it will throw a SegmentLoadingException @throws SegmentLoadingException if it fails to load the given segment
private void loadSegment(DataSegment segment, DataSegmentChangeCallback callback, boolean lazy, @Nullable
      ExecutorService loadSegmentIntoPageCacheExec)
      throws SegmentLoadingException
  {
    final boolean loaded;
    try {
      loaded = segmentManager.loadSegment(segment,
              lazy,
          () -> this.removeSegment(segment, DataSegmentChangeCallback.NOOP, false),
              loadSegmentIntoPageCacheExec
      );
    }
    catch (Exception e) {
      removeSegment(segment, callback, false);
      throw new SegmentLoadingException(e, "Exception loading segment[%s]", segment.getId());
    }
    if (loaded) {
      File segmentInfoCacheFile = new File(config.getInfoDir(), segment.getId().toString());
      if (!segmentInfoCacheFile.exists()) {
        try {
          jsonMapper.writeValue(segmentInfoCacheFile, segment);
        }
        catch (IOException e) {
          removeSegment(segment, callback, false);
          throw new SegmentLoadingException(
              e,
              "Failed to write to disk segment info cache file[%s]",
              segmentInfoCacheFile
          );
        }
      }
    }
  }
private void loadSegment ( DataSegment segment , DataSegmentChangeCallback callback , boolean lazy , @ Nullable ExecutorService loadSegmentIntoPageCacheExec ) throws SegmentLoadingException { final boolean loaded ; try { loaded = segmentManager . loadSegment ( segment , lazy , ( ) -> this . removeSegment ( segment , DataSegmentChangeCallback . NOOP , false ) , loadSegmentIntoPageCacheExec ) ; } catch ( Exception e ) { removeSegment ( segment , callback , false ) ; throw new SegmentLoadingException ( e , "Exception loading segment[%s]" , segment . getId ( ) ) ; } if ( loaded ) { File segmentInfoCacheFile = new File ( config . getInfoDir ( ) , segment . getId ( ) . toString ( ) ) ; if ( ! segmentInfoCacheFile . exists ( ) ) { try { jsonMapper . writeValue ( segmentInfoCacheFile , segment ) ; } catch ( IOException e ) { removeSegment ( segment , callback , false ) ; throw new SegmentLoadingException ( e , "Failed to write to disk segment info cache file[%s]" , segmentInfoCacheFile ) ; } } } }
Load a single segment.
Load a single segment .