public static List<Record> tieredStorageRecords(TieredStorageTestContext context,
                                                    TopicPartition topicPartition) {
        return context.takeTieredStorageSnapshot()
                .getFilesets(topicPartition)
                .stream()
                .map(fileset -> {
                    try {
                        return fileset.getRecords();
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                })
                .sorted(Comparator.comparingLong(records -> records.get(0).offset()))
                .flatMap(Collection::stream)
                .collect(Collectors.toList());
    }
Get the records found in the local tiered storage.
Snapshot does not sort the filesets by base offset.
@param context The test context.
@param topicPartition The topic-partition of the records.
@return The records found in the local tiered storage.
storage/src/test/java/org/apache/kafka/tiered/storage/utils/TieredStorageTestUtils.java