jsancio commented on code in PR #12655:
URL: https://github.com/apache/kafka/pull/12655#discussion_r973519728
##########
core/src/main/scala/kafka/raft/KafkaMetadataLog.scala:
##########
@@ -556,15 +556,29 @@ object KafkaMetadataLog {
config: MetadataLogConfig
): KafkaMetadataLog = {
val props = new Properties()
- props.put(LogConfig.MaxMessageBytesProp,
config.maxBatchSizeInBytes.toString)
- props.put(LogConfig.SegmentBytesProp, Int.box(config.logSegmentBytes))
- props.put(LogConfig.SegmentMsProp, Long.box(config.logSegmentMillis))
- props.put(LogConfig.FileDeleteDelayMsProp,
Int.box(Defaults.FileDeleteDelayMs))
+ props.setProperty(LogConfig.MaxMessageBytesProp,
config.maxBatchSizeInBytes.toString)
+ props.setProperty(LogConfig.SegmentBytesProp,
config.logSegmentBytes.toString)
+ props.setProperty(LogConfig.SegmentMsProp,
config.logSegmentMillis.toString)
+ props.setProperty(LogConfig.FileDeleteDelayMsProp,
Defaults.FileDeleteDelayMs.toString)
+
+ // Disable time and byte retention when deleting segments
+ props.setProperty(LogConfig.RetentionMsProp, "-1")
+ props.setProperty(LogConfig.RetentionBytesProp, "-1")
LogConfig.validateValues(props)
val defaultLogConfig = LogConfig(props)
if (config.logSegmentBytes < config.logSegmentMinBytes) {
- throw new InvalidConfigurationException(s"Cannot set
$MetadataLogSegmentBytesProp below ${config.logSegmentMinBytes}")
+ throw new InvalidConfigurationException(
+ s"Cannot set $MetadataLogSegmentBytesProp below
${config.logSegmentMinBytes}: ${config.logSegmentBytes}"
+ )
+ } else if (defaultLogConfig.retentionMs >= 0) {
Review Comment:
It is the same. I learned to do this because it lowers the cyclomatic
complexity. It looks like the static analyzer understand `else if` but not
`throw` when computing that value.
--
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]