You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/02/17 19:01:23 UTC

[GitHub] [kafka] jsancio commented on a change in pull request #10138: KAFKA-12331: Use LEO for the base offset of LeaderChangeMessage batch

jsancio commented on a change in pull request #10138:
URL: https://github.com/apache/kafka/pull/10138#discussion_r577868426



##########
File path: raft/src/test/java/org/apache/kafka/raft/MockLog.java
##########
@@ -250,30 +249,7 @@ private LogEntry buildEntry(Long offset, SimpleRecord record) {
 
     @Override
     public LogAppendInfo appendAsLeader(Records records, int epoch) {
-        if (records.sizeInBytes() == 0)
-            throw new IllegalArgumentException("Attempt to append an empty record set");
-
-        long baseOffset = endOffset().offset;
-        AtomicLong offsetSupplier = new AtomicLong(baseOffset);
-        for (RecordBatch batch : records.batches()) {
-            List<LogEntry> entries = buildEntries(batch, record -> offsetSupplier.getAndIncrement());
-            appendBatch(new LogBatch(epoch, batch.isControlBatch(), entries));
-        }
-
-        return new LogAppendInfo(baseOffset, offsetSupplier.get() - 1);
-    }
-
-    LogAppendInfo appendAsLeader(Collection<SimpleRecord> records, int epoch) {

Review comment:
       This method was only used for tests. To simplify the implementation, I remove this method and added a helper method to `MockLogTest`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org