long findLogStartOffset(TopicIdPartition topicIdPartition, UnifiedLog log) throws RemoteStorageException {
        Optional<Long> logStartOffset = Optional.empty();
        Option<LeaderEpochFileCache> maybeLeaderEpochFileCache = log.leaderEpochCache();
        if (maybeLeaderEpochFileCache.isDefined()) {
            LeaderEpochFileCache cache = maybeLeaderEpochFileCache.get();
            OptionalInt earliestEpochOpt = cache.earliestEntry()
                    .map(epochEntry -> OptionalInt.of(epochEntry.epoch))
                    .orElseGet(OptionalInt::empty);
            while (!logStartOffset.isPresent() && earliestEpochOpt.isPresent()) {
                Iterator<RemoteLogSegmentMetadata> iterator =
                        remoteLogMetadataManager.listRemoteLogSegments(topicIdPartition, earliestEpochOpt.getAsInt());
                if (iterator.hasNext()) {
                    logStartOffset = Optional.of(iterator.next().startOffset());
                }
                earliestEpochOpt = cache.nextEpoch(earliestEpochOpt.getAsInt());
            }
        }
        return logStartOffset.orElseGet(log::localLogStartOffset);
    }
Returns a map containing the epoch vs start-offset for the given leader epoch map by filtering the epochs that
does not contain any messages/records associated with them.
For ex:
<pre>
{@code
 <epoch - start offset>
 0 - 0
 1 - 10
 2 - 20
 3 - 30
 4 - 40
 5 - 60  // epoch 5 does not have records or messages associated with it
 6 - 60
 7 - 70
}
</pre>
When the above leaderEpochMap is passed to this method, it returns the following map:
<pre>
{@code
 <epoch - start offset>
 0 - 0
 1 - 10
 2 - 20
 3 - 30
 4 - 40
 6 - 60
 7 - 70
}
</pre>
@param leaderEpochs The leader epoch map to be refined.
core/src/main/java/kafka/log/remote/RemoteLogManager.java