ahuang98 commented on code in PR #17544:
URL: https://github.com/apache/kafka/pull/17544#discussion_r1913961899


##########
metadata/src/test/java/org/apache/kafka/metalog/LocalLogManager.java:
##########
@@ -725,19 +735,35 @@ public long prepareAppend(
         int epoch,
         List<ApiMessageAndVersion> batch
     ) {
+        if (!leader.isLeader(nodeId)) {
+            log.debug("prepareAppend(nodeId={}, epoch={}): the given node id 
does not " +
+                    "match the current leader id of {}.", nodeId, epoch, 
leader.leaderId());
+            throw new NotLeaderException("Append failed because the 
replication is not the current leader");
+        }
+
         if (batch.isEmpty()) {
             throw new IllegalArgumentException("Batch cannot be empty");
         }
 
         if (throwOnNextAppend.getAndSet(false)) {
             throw new BufferAllocationException("Test asked to fail the next 
prepareAppend");
         }
-
-        return shared.tryAppend(nodeId, epoch, batch);
+        long appendTimestamp = (shared.prevOffset + 1) * 10;

Review Comment:
   why not use logEndOffset()? 



-- 
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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

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

Reply via email to