private static Set<TopicPartition> getAllPartitions(
      KafkaConsumer<byte[], byte[]> consumer, String topic) {
    return consumer.partitionsFor(topic).stream()
        .map(info -> new TopicPartition(info.topic(), info.partition()))
        .collect(Collectors.toSet());
  }
Drain all records available from the given topic from the beginning until the current highest
offset.

<p>This method will fetch the latest offsets for the partitions once and only return records
until that point.

@param topic to fetch from
@param properties used to configure the created {@link KafkaConsumer}
@return all {@link ConsumerRecord} in the topic
@throws KafkaException
amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/test/java/org/apache/amoro/flink/kafka/testutils/KafkaUtil.java