public void record(Uuid topicId) {
        // Topic IDs should not differ, but we defensively check here to fail earlier in the case that the IDs somehow differ.
        dirtyTopicIdOpt.ifPresent(dirtyTopicId -> {
            if (!dirtyTopicId.equals(topicId)) {
                throw new InconsistentTopicIdException("Tried to record topic ID " + topicId + " to file " +
                        "but had already recorded " + dirtyTopicId);
            }
        });
        dirtyTopicIdOpt = Optional.of(topicId);
    }
Records the topic ID that will be flushed to disk.
storage/src/main/java/org/apache/kafka/storage/internals/checkpoint/PartitionMetadataFile.java