cmccabe commented on code in PR #17502: URL: https://github.com/apache/kafka/pull/17502#discussion_r1811528002
########## metadata/src/main/java/org/apache/kafka/controller/QuorumController.java: ########## @@ -1855,6 +1633,97 @@ private QuorumController( this.raftClient.register(metaLogListener); } + /** + * Register the writeNoOpRecord task. + * + * This task periodically writes a NoOpRecord to the metadata log, if the MetadataVersion + * supports it. + * + * @param maxIdleIntervalNs The period at which to write the NoOpRecord. + */ + private void registerWriteNoOpRecord(long maxIdleIntervalNs) { + periodicControl.registerTask(new PeriodicTask("writeNoOpRecord", + () -> { + ArrayList<ApiMessageAndVersion> records = new ArrayList<>(1); + if (featureControl.metadataVersion().isNoOpRecordSupported()) { + records.add(new ApiMessageAndVersion(new NoOpRecord(), (short) 0)); + } + return ControllerResult.of(records, false); + }, + maxIdleIntervalNs, + EnumSet.noneOf(PeriodicTaskFlag.class))); + } + + /** + * Calculate what the period should be for the maybeFenceStaleBroker task. + * + * @param sessionTimeoutNs The configured broker session timeout period in nanoseconds. + * + * @return The period for the maybeFenceStaleBroker task in nanoseconds. + */ + static long maybeFenceStaleBrokerPeriodNs(long sessionTimeoutNs) { + return Math.max(TimeUnit.MILLISECONDS.toNanos(1), sessionTimeoutNs / 4); Review Comment: Thinking about it more I will divide by 8. I will also add a comment explaining the rationale. -- 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