mumrah commented on code in PR #16862:
URL: https://github.com/apache/kafka/pull/16862#discussion_r1717171662


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -817,27 +817,25 @@ public void run() throws Exception {
                         // succeed; if it does not, that's a fatal error. It 
is important to do this before
                         // scheduling the record for Raft replication.
                         int recordIndex = 0;
-                        long nextWriteOffset = offsetControl.nextWriteOffset();
+                        long lastOffset = 
raftClient.prepareAppend(controllerEpoch, records);
+                        long baseOffset = lastOffset - records.size() + 1;
                         for (ApiMessageAndVersion message : records) {
-                            long recordOffset = nextWriteOffset + recordIndex;
+                            long recordOffset = baseOffset + recordIndex;
                             try {
                                 replay(message.message(), Optional.empty(), 
recordOffset);
                             } catch (Throwable e) {

Review Comment:
   Do we need to do any cleanup to RaftClient if we hit a replay exception? Or 
is that handled by the resign code path?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to