public static MemoryRecordsBuilder builder(ByteBuffer buffer,
                                               byte magic,
                                               Compression compression,
                                               TimestampType timestampType,
                                               long baseOffset) {
        long logAppendTime = RecordBatch.NO_TIMESTAMP;
        if (timestampType == TimestampType.LOG_APPEND_TIME)
            logAppendTime = System.currentTimeMillis();
        return builder(buffer, magic, compression, timestampType, baseOffset, logAppendTime,
                RecordBatch.NO_PRODUCER_ID, RecordBatch.NO_PRODUCER_EPOCH, RecordBatch.NO_SEQUENCE, false,
                RecordBatch.NO_PARTITION_LEADER_EPOCH);
    }
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