private void maybeUpdateCopiedOffset(UnifiedLog log) throws RemoteStorageException {
            if (!copiedOffsetOption.isPresent()) {
                // This is found by traversing from the latest leader epoch from leader epoch history and find the highest offset
                // of a segment with that epoch copied into remote storage. If it can not find an entry then it checks for the
                // previous leader epoch till it finds an entry, If there are no entries till the earliest leader epoch in leader
                // epoch cache then it starts copying the segments from the earliest epoch entry's offset.
                copiedOffsetOption = Optional.of(findHighestRemoteOffset(topicIdPartition, log));
                logger.info("Found the highest copiedRemoteOffset: {} for partition: {} after becoming leader", copiedOffsetOption, topicIdPartition);
                copiedOffsetOption.ifPresent(offsetAndEpoch ->  log.updateHighestOffsetInRemoteStorage(offsetAndEpoch.offset()));
            }
        }
Returns the leader epoch entries within the range of the given start[exclusive] and end[inclusive] offset.
<p>
Visible for testing.

@param log         The actual log from where to take the leader-epoch checkpoint
@param startOffset The start offset of the epoch entries (inclusive).
                   If start offset is 6, then it will retain an entry at offset 6.
@param endOffset   The end offset of the epoch entries (exclusive)
                   If end offset is 100, then it will remove the entries greater than or equal to 100.
@return the leader epoch entries
core/src/main/java/kafka/log/remote/RemoteLogManager.java