private boolean needsCopying(Offset offset) {
    if (!compactionLog.isIndexSegmentOffsetsPersisted()) {
      // If index segment offsets are not saved within compaction log, then just use recovery start token to decide if
      // we should copy this index segment.
      return recoveryStartToken == null || recoveryStartToken.getOffset().compareTo(offset) < 0;
    }
    // We have index segment offsets from compaction log, every index segment whose offset exists in the compaction log
    // already has its content copied, with the last index segment as exception since it might be halfway through copying.
    NavigableMap<Offset, Offset> indexSegmentOffsets = compactionLog.getBeforeAndAfterIndexSegmentOffsets();
    Map.Entry<Offset, Offset> lastEntry = indexSegmentOffsets.lastEntry();
    return lastEntry == null || lastEntry.getKey().compareTo(offset) < 0;
  }
Determines if the offset has been copied or requires copying.
@param offset the {@link Offset} to test at.
@return {@code true} if copying is required. {@code false} otherwise.
ambry-store/src/main/java/com/github/ambry/store/BlobStoreCompactor.java