jsancio commented on code in PR #16862:
URL: https://github.com/apache/kafka/pull/16862#discussion_r1717180102
##########
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:
Yeah. It is handle by the controller renounce code. The old code left it to
the state machine (controller) to determine if a failure to write/append should
result in a leader change. It is probably good to keep the same semantic unless
we have a good reason to change it.
--
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]