jsancio commented on code in PR #12183:
URL: https://github.com/apache/kafka/pull/12183#discussion_r882942653
##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -302,12 +302,30 @@ public QuorumController build() throws Exception {
KafkaEventQueue queue = null;
try {
queue = new KafkaEventQueue(time, logContext, threadNamePrefix
+ "QuorumController");
- return new QuorumController(logContext, nodeId, clusterId,
queue, time,
- configSchema, raftClient, quorumFeatures,
defaultReplicationFactor,
- defaultNumPartitions, isLeaderRecoverySupported,
replicaPlacer, snapshotMaxNewRecordBytes,
- leaderImbalanceCheckIntervalNs, sessionTimeoutNs,
controllerMetrics,
- createTopicPolicy, alterConfigPolicy,
configurationValidator, authorizer,
- staticConfig, bootstrapMetadata);
+ return new QuorumController(
Review Comment:
Hehe. I thought it was improvement. I always find the previous style harder
to read and update.
##########
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:
Done.
--
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]