@Test
    public void testSetLogAppendTimeV1() {
        MemoryRecords records = MemoryRecords.withRecords(RecordBatch.MAGIC_VALUE_V1, 0L,
                Compression.gzip().build(), TimestampType.CREATE_TIME,
                new SimpleRecord(1L, "a".getBytes(), "1".getBytes()),
                new SimpleRecord(2L, "b".getBytes(), "2".getBytes()),
                new SimpleRecord(3L, "c".getBytes(), "3".getBytes()));

        long logAppendTime = 15L;

        ByteBufferLegacyRecordBatch batch = new ByteBufferLegacyRecordBatch(records.buffer());
        batch.setMaxTimestamp(TimestampType.LOG_APPEND_TIME, logAppendTime);
        assertEquals(TimestampType.LOG_APPEND_TIME, batch.timestampType());
        assertEquals(logAppendTime, batch.maxTimestamp());
        assertTrue(batch.isValid());

        List<MutableRecordBatch> recordBatches = Utils.toList(records.batches().iterator());
        assertEquals(1, recordBatches.size());
        assertEquals(TimestampType.LOG_APPEND_TIME, recordBatches.get(0).timestampType());
        assertEquals(logAppendTime, recordBatches.get(0).maxTimestamp());

        for (Record record : records.records())
            assertEquals(logAppendTime, record.timestamp());
    }
The wrapper offset should be 0 in v0, but not in v1. However, the latter worked by accident and some versions of
librdkafka now depend on it. So we support 0 for compatibility reasons, but the recommendation is to set the
wrapper offset to the relative offset of the last record in the batch.
clients/src/test/java/org/apache/kafka/common/record/AbstractLegacyRecordBatchTest.java