-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-13996: log.cleaner.io.max.bytes.per.second can be changed dynamically #12296
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 8 commits
2ffceb5
ec4c24e
0426496
1a574d6
9b2477d
e05707d
f9d27f6
5c72740
ba640f5
452a961
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 |
|---|---|---|
|
|
@@ -23,9 +23,8 @@ import java.nio.charset.StandardCharsets | |
| import java.nio.file.Paths | ||
| import java.util.Properties | ||
| import java.util.concurrent.{CountDownLatch, TimeUnit} | ||
|
|
||
| import kafka.common._ | ||
| import kafka.server.{BrokerTopicStats, LogDirFailureChannel} | ||
| import kafka.server.{BrokerTopicStats, KafkaConfig, LogDirFailureChannel} | ||
| import kafka.utils._ | ||
| import org.apache.kafka.common.TopicPartition | ||
| import org.apache.kafka.common.errors.CorruptRecordException | ||
|
|
@@ -1854,6 +1853,35 @@ class LogCleanerTest { | |
| } finally logCleaner.shutdown() | ||
| } | ||
|
|
||
| @Test | ||
| def testReconfigureLogCleanerIoMaxBytesPerSecond(): Unit = { | ||
| val oldKafkaProps = TestUtils.createBrokerConfig(1, "localhost:2181") | ||
| oldKafkaProps.put(KafkaConfig.LogCleanerIoMaxBytesPerSecondProp, 10000000: java.lang.Double) | ||
|
Member
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. nit: I think we can just put
Contributor
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. Thank you for noticing.
Member
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. Thanks for the update! |
||
|
|
||
| val logCleaner = new LogCleaner(LogCleaner.cleanerConfig(new KafkaConfig(oldKafkaProps)), | ||
| logDirs = Array(TestUtils.tempDir()), | ||
| logs = new Pool[TopicPartition, UnifiedLog](), | ||
| logDirFailureChannel = new LogDirFailureChannel(1), | ||
| time = time) { | ||
| // shutdown() and startup() are called in LogCleaner.reconfigure(). | ||
| // Empty startup() and shutdown() to ensure that no unnecessary log cleaner threads remain after this test. | ||
| override def startup(): Unit = {} | ||
| override def shutdown(): Unit = {} | ||
| } | ||
|
|
||
| try { | ||
| assertEquals(10000000, logCleaner.throttler.desiredRatePerSec, s"Throttler.desiredRatePerSec should be initialized from initial `${KafkaConfig.LogCleanerIoMaxBytesPerSecondProp}` config.") | ||
|
|
||
| val newKafkaProps = TestUtils.createBrokerConfig(1, "localhost:2181") | ||
| newKafkaProps.put(KafkaConfig.LogCleanerIoMaxBytesPerSecondProp, 20000000: java.lang.Double) | ||
|
|
||
| logCleaner.reconfigure(new KafkaConfig(oldKafkaProps), new KafkaConfig(newKafkaProps)) | ||
|
|
||
| assertEquals(20000000, logCleaner.throttler.desiredRatePerSec, s"Throttler.desiredRatePerSec should be updated with new `${KafkaConfig.LogCleanerIoMaxBytesPerSecondProp}` config.") | ||
| } finally { | ||
| logCleaner.shutdown() | ||
| } | ||
| } | ||
|
|
||
| private def writeToLog(log: UnifiedLog, keysAndValues: Iterable[(Int, Int)], offsetSeq: Iterable[Long]): Iterable[Long] = { | ||
| for(((key, value), offset) <- keysAndValues.zip(offsetSeq)) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.