private void processLogSegment(LogInfo logInfo, String partitionToMountFilePath, FileCopyInfo fileCopyInfo,
      String snapshotId, PartitionFileStore fileStore) {
    if (logInfo.getLogSegment().getFileSize() > fileStore.getSegmentCapacity()) {
      throw new FileCopyHandlerException("Log segment file size is greater than the segment capacity",
          FileCopyHandlerException.FileCopyHandlerErrorCode.FileCopyHandlerInvalidLogFileSize);
    }
    FileInfo logFileInfo = new StoreFileInfo(logInfo.getLogSegment().getFileName() + "_log",
        logInfo.getLogSegment().getFileSize());
    int chunksInLogSegment = (int) Math.ceil((double) logFileInfo.getFileSize() / config.getFileCopyHandlerChunkSize);
    logger.info("Number of chunks in log segment: {} for filename {}", chunksInLogSegment, logFileInfo.getFileName());

    for (int i = 0; i < chunksInLogSegment; i++) {
      //Throw Exception and come out of the thread a shutdown is called.
      validateIfStoreFileCopyHandlerIsRunning();
      long startOffset = (long) i * config.getFileCopyHandlerChunkSize;
      long sizeInBytes = Math.min(config.getFileCopyHandlerChunkSize, logFileInfo.getFileSize() - startOffset);

      String operationName = GetChunkDataWorkflow.GET_CHUNK_OPERATION_NAME + "[Partition=" +
          fileCopyInfo.getTargetReplicaId().getPartitionId().getId() + ", FileName=" + logFileInfo.getFileName() +
          ", Chunk=" + (i + 1) + "]";
      FileChunkInfo fileChunkInfo = new FileChunkInfo(logFileInfo.getFileName(), startOffset, sizeInBytes, true);

       FileCopyGetChunkResponse chunkResponse = null;
       try {
         chunkResponse = getFileCopyGetChunkResponse(operationName, fileCopyInfo, fileChunkInfo, snapshotId,true);
         String filePath = partitionToMountFilePath + File.separator + logFileInfo.getFileName();
         writeStoreFileChunkToDisk(chunkResponse, filePath, fileStore);
      } finally {
         if (chunkResponse != null) {
            chunkResponse.release();
         }
      }
    }
  }
Process the log segment.
@param logInfo the log info to process
@param partitionToMountFilePath the partition file path
@param fileCopyInfo the file copy info
@param fileStore the file store
ambry-file-transfer/src/main/java/com/github/ambry/filetransfer/handler/StoreFileCopyHandler.java