-
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 5 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,26 @@ class LogCleanerTest { | |
| } finally logCleaner.shutdown() | ||
| } | ||
|
|
||
| @Test | ||
| def testReconfigureLogCleanerIoMaxBytesPerSecond(): Unit = { | ||
| val oldKafkaProps = TestUtils.createBrokerConfig(1, "localhost:2181") | ||
| oldKafkaProps.put(KafkaConfig.LogCleanerIoMaxBytesPerSecondProp, 10000000) | ||
|
|
||
| val logCleaner = new LogCleaner(LogCleaner.cleanerConfig(new KafkaConfig(oldKafkaProps)), | ||
| logDirs = Array(TestUtils.tempDir()), | ||
| logs = new Pool[TopicPartition, UnifiedLog](), | ||
| logDirFailureChannel = new LogDirFailureChannel(1), | ||
| time = time) | ||
|
|
||
| assertEquals(logCleaner.throttler.desiredRatePerSec, 10000000, "Throttler.desiredRatePerSec should be initialized with KafkaConfig.LogCleanerIoMaxBytesPerSecondProp") | ||
|
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: the 1st parameter of
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. Also, the error message might be able to update to:
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. I’ve updated the assert method parameters and the error message. |
||
|
|
||
| val newKafkaProps = TestUtils.createBrokerConfig(1, "localhost:2181") | ||
| newKafkaProps.put(KafkaConfig.LogCleanerIoMaxBytesPerSecondProp, 20000000) | ||
|
|
||
| logCleaner.reconfigure(new KafkaConfig(oldKafkaProps), new KafkaConfig(newKafkaProps)) | ||
|
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. I think the
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. Your concern is correct. Thank you. |
||
|
|
||
| assertEquals(logCleaner.throttler.desiredRatePerSec, 20000000, "Throttler.desiredRatePerSec should be updated with new KafkaConfig.LogCleanerIoMaxBytesPerSecondProp") | ||
|
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. The error message might be able to update to:
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. I’ve update the error message. |
||
| } | ||
|
|
||
| private def writeToLog(log: UnifiedLog, keysAndValues: Iterable[(Int, Int)], offsetSeq: Iterable[Long]): Iterable[Long] = { | ||
| for(((key, value), offset) <- keysAndValues.zip(offsetSeq)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2
andin the sentence now. Maybe we can put it like this to make it clear:WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I’ve update the comment.
f9d27f6