public static MemoryRecordsBuilder idempotentBuilder(ByteBuffer buffer,
                                                         Compression compression,
                                                         long baseOffset,
                                                         long producerId,
                                                         short producerEpoch,
                                                         int baseSequence) {
        return builder(buffer, RecordBatch.CURRENT_MAGIC_VALUE, compression, TimestampType.CREATE_TIME,
                baseOffset, System.currentTimeMillis(), producerId, producerEpoch, baseSequence);
    }
Check whether a record should be retained in the log. Note that {@link #checkBatchRetention(RecordBatch)}
is used prior to checking individual record retention. Only records from batches which were not
explicitly discarded with {@link BatchRetention#DELETE} will be considered.
clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java