-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-14307; Controller time-based snapshots #12761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
1208249
74607ca
53c854f
464e7a3
de7e8ec
d9e27c4
32af1e7
2a1a21a
057d09c
e510304
2221264
495d876
dbc3aeb
81d4724
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,6 +81,7 @@ object Defaults { | |
| val BrokerHeartbeatIntervalMs = 2000 | ||
| val BrokerSessionTimeoutMs = 9000 | ||
| val MetadataSnapshotMaxNewRecordBytes = 20 * 1024 * 1024 | ||
| val MetadataSnapshotMaxIntervalMs = TimeUnit.HOURS.toMillis(1); | ||
| val MetadataMaxIdleIntervalMs = 500 | ||
|
|
||
| /** KRaft mode configs */ | ||
|
|
@@ -400,6 +401,7 @@ object KafkaConfig { | |
| val NodeIdProp = "node.id" | ||
| val MetadataLogDirProp = "metadata.log.dir" | ||
| val MetadataSnapshotMaxNewRecordBytesProp = "metadata.log.max.record.bytes.between.snapshots" | ||
| val MetadataSnapshotMaxIntervalMsProp = "metadata.log.max.snapshot.interval.ms" | ||
| val ControllerListenerNamesProp = "controller.listener.names" | ||
| val SaslMechanismControllerProtocolProp = "sasl.mechanism.controller.protocol" | ||
| val MetadataLogSegmentMinBytesProp = "metadata.log.segment.min.bytes" | ||
|
|
@@ -725,7 +727,15 @@ object KafkaConfig { | |
| "This is required configuration when running in KRaft mode." | ||
| val MetadataLogDirDoc = "This configuration determines where we put the metadata log for clusters in KRaft mode. " + | ||
| "If it is not set, the metadata log is placed in the first log directory from log.dirs." | ||
| val MetadataSnapshotMaxNewRecordBytesDoc = "This is the maximum number of bytes in the log between the latest snapshot and the high-watermark needed before generating a new snapshot." | ||
| val MetadataSnapshotMaxNewRecordBytesDoc = "This is the maximum number of bytes in the log between the latest " + | ||
| "snapshot and the high-watermark needed before generating a new snapshot. The default value is " + | ||
| s"${Defaults.MetadataSnapshotMaxNewRecordBytes}. To geneate snapshots based on the time elapsed, see " + | ||
| s"the <code>$MetadataSnapshotMaxIntervalMsProp</code> configuration." | ||
| val MetadataSnapshotMaxIntervalMsDoc = "This is the maximum number of milliseconds to wait to generate a snapshot " + | ||
| "if there are committed records in the log that are not included in the latest snapshot. A value of zero disables " + | ||
| s"time based snapshot generation. The default value is ${Defaults.MetadataSnapshotMaxIntervalMs}. To geneate " + | ||
| s"snapshots based on the number of metadata bytes, see the <code>$MetadataSnapshotMaxNewRecordBytesProp</code> " + | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of just referring to the other configuration, I was thinking we could mention that snapshots will be taken when either the interval is reached or the max bytes limit is reached.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Added a sentence to both descriptions explaining this. |
||
| "configuration." | ||
| val MetadataMaxIdleIntervalMsDoc = "This configuration controls how often the active " + | ||
| "controller should write no-op records to the metadata partition. If the value is 0, no-op records " + | ||
| s"are not appended to the metadata partition. The default value is ${Defaults.MetadataMaxIdleIntervalMs}"; | ||
|
|
@@ -1157,6 +1167,7 @@ object KafkaConfig { | |
| * KRaft mode configs. | ||
| */ | ||
| .define(MetadataSnapshotMaxNewRecordBytesProp, LONG, Defaults.MetadataSnapshotMaxNewRecordBytes, atLeast(1), HIGH, MetadataSnapshotMaxNewRecordBytesDoc) | ||
| .define(MetadataSnapshotMaxIntervalMsProp, LONG, Defaults.MetadataSnapshotMaxIntervalMs, atLeast(0), HIGH, MetadataSnapshotMaxIntervalMsDoc) | ||
|
|
||
| /* | ||
| * KRaft mode private configs. Note that these configs are defined as internal. We will make them public in the 3.0.0 release. | ||
|
|
@@ -1697,6 +1708,7 @@ class KafkaConfig private(doLog: Boolean, val props: java.util.Map[_, _], dynami | |
|
|
||
| /************* Metadata Configuration ***********/ | ||
| val metadataSnapshotMaxNewRecordBytes = getLong(KafkaConfig.MetadataSnapshotMaxNewRecordBytesProp) | ||
| val metadataSnapshotMaxIntervalMs = getLong(KafkaConfig.MetadataSnapshotMaxIntervalMsProp) | ||
| val metadataMaxIdleIntervalNs: Option[Long] = { | ||
| val value = TimeUnit.NANOSECONDS.convert(getInt(KafkaConfig.MetadataMaxIdleIntervalMsProp).toLong, TimeUnit.MILLISECONDS) | ||
| if (value > 0) Some(value) else None | ||
|
|
@@ -2282,7 +2294,7 @@ class KafkaConfig private(doLog: Boolean, val props: java.util.Map[_, _], dynami | |
|
|
||
| val principalBuilderClass = getClass(KafkaConfig.PrincipalBuilderClassProp) | ||
| require(principalBuilderClass != null, s"${KafkaConfig.PrincipalBuilderClassProp} must be non-null") | ||
| require(classOf[KafkaPrincipalSerde].isAssignableFrom(principalBuilderClass), | ||
| require(classOf[KafkaPrincipalSerde].isAssignableFrom(principalBuilderClass), | ||
| s"${KafkaConfig.PrincipalBuilderClassProp} must implement KafkaPrincipalSerde") | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.