private CompletableFuture<Integer> getStartSearchIndex0(NodeS3StreamSetObjectMetadataImage node, long startOffset,
        GetObjectsContext ctx) {
        if (node == null) {
            return CompletableFuture.completedFuture(0);
        }
        // search in compact cache first
        int index = node.floorStreamSetObjectIndex(ctx.streamId, startOffset);
        if (index > 0) {
            return CompletableFuture.completedFuture(index);
        }
        // search in sparse index
        ctx.isFromSparseIndex = true;
        return getStartStreamSetObjectId(node.getNodeId(), startOffset, ctx)
            .thenApply(objectId -> {
                int startIndex = -1;
                if (objectId >= 0) {
                    startIndex = findStartSearchIndex(objectId, node.orderList());
                    MetadataStats.getInstance().getRangeIndexHitCountStats().add(MetricsLevel.INFO, 1);
                } else {
                    MetadataStats.getInstance().getRangeIndexMissCountStats().add(MetricsLevel.INFO, 1);
                }
                if (startIndex < 0 && ctx.indexCache.nodeId() != node.getNodeId()) {
                    NodeRangeIndexCache.getInstance().invalidate(node.getNodeId());
                    MetadataStats.getInstance().getRangeIndexInvalidateCountStats().add(MetricsLevel.INFO, 1);
                }
                return Math.max(0, startIndex);
            });
    }
Get the index where to start search stream set object from.
metadata/src/main/java/org/apache/kafka/image/S3StreamsMetadataImage.java