cmccabe commented on code in PR #12183:
URL: https://github.com/apache/kafka/pull/12183#discussion_r882194131
##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -1010,6 +1028,38 @@ private void maybeCompleteAuthorizerInitialLoad() {
}
}
+ private boolean isActiveController() {
+ return curClaimEpoch != -1;
+ }
+
+ private void updateWriteOffset(long offset) {
+ writeOffset = offset;
+ if (isActiveController()) {
+ controllerMetrics.setLastAppliedRecordOffset(writeOffset);
+ // This is not truly the append timestamp. The KRaft client
doesn't expose the append time when scheduling a write.
+ // This is good enough because this is called right after the
records were given to the KRAft client for appending and
+ // the default append linger for KRaft is 25ms.
+
controllerMetrics.setLastAppliedRecordTimestamp(time.milliseconds());
+ } else {
+ // This is called with an offset of -1 when the active controller
renounced leadership
Review Comment:
Maybe the comment should just mention that lastAppliedRecordOffset tracks
last committed offset for standbys.
The bit about writeOffset being -1 is a bit low-level (it is true but that
feels more like an implementation detail here...)
--
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]