private static boolean recordHasInvalidTimestamp(Record record,
                                                     long now,
                                                     long timestampBeforeMaxMs,
                                                     long timestampAfterMaxMs) {
        final long timestampDiff = now - record.timestamp();
        return timestampDiff > timestampBeforeMaxMs ||
                -1 * timestampDiff > timestampAfterMaxMs;
    }
We cannot do in place assignment in one of the following situations:
1. Source and target compression codec are different
2. When the target magic is not equal to batches' magic, meaning format conversion is needed.
3. When the target magic is equal to V0, meaning absolute offsets need to be re-assigned.
storage/src/main/java/org/apache/kafka/storage/internals/log/LogValidator.java