[jira] [Commented] (KAFKA-6637) if set topic config segment.ms=0 Kafka broker won't be able to start

2018-03-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-6637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16412746#comment-16412746
 ] 

ASF GitHub Bot commented on KAFKA-6637:
---

hachikuji closed pull request #4698: KAFKA-6637: Avoid divide /zero error with 
segment.ms set to zero
URL: https://github.com/apache/kafka/pull/4698
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/scala/kafka/log/LogConfig.scala 
b/core/src/main/scala/kafka/log/LogConfig.scala
index 30ca333dd28..0db49e76e2e 100755
--- a/core/src/main/scala/kafka/log/LogConfig.scala
+++ b/core/src/main/scala/kafka/log/LogConfig.scala
@@ -214,7 +214,7 @@ object LogConfig {
 new LogConfigDef()
   .define(SegmentBytesProp, INT, Defaults.SegmentSize, 
atLeast(Message.MinMessageOverhead), MEDIUM,
 SegmentSizeDoc, KafkaConfig.LogSegmentBytesProp)
-  .define(SegmentMsProp, LONG, Defaults.SegmentMs, atLeast(0), MEDIUM, 
SegmentMsDoc,
+  .define(SegmentMsProp, LONG, Defaults.SegmentMs, atLeast(1), MEDIUM, 
SegmentMsDoc,
 KafkaConfig.LogRollTimeMillisProp)
   .define(SegmentJitterMsProp, LONG, Defaults.SegmentJitterMs, atLeast(0), 
MEDIUM, SegmentJitterMsDoc,
 KafkaConfig.LogRollTimeJitterMillisProp)


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> if set topic config segment.ms=0 Kafka broker won't be able to start
> 
>
> Key: KAFKA-6637
> URL: https://issues.apache.org/jira/browse/KAFKA-6637
> Project: Kafka
>  Issue Type: Bug
>Affects Versions: 1.0.0
>Reporter: Chong Wang
>Assignee: huxihx
>Priority: Major
>
> If set topic config segment.ms to 0, Kafka server won't be able to start 
> because of a FATAL error:
> [2018-03-12 19:05:40,196] FATAL [KafkaServer id=2] Fatal error during 
> KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) 
> java.lang.ArithmeticException: / by zero at 
> kafka.log.LogConfig.randomSegmentJitter(LogConfig.scala:100) at 
> kafka.log.Log.loadSegments(Log.scala:419) at 
> kafka.log.Log.(Log.scala:203) at kafka.log.Log$.apply(Log.scala:1734) 
> at kafka.log.LogManager.kafka$log$LogManager$$loadLog(LogManager.scala:221) 
> at 
> kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$8$$anonfun$apply$16$$anonfun$apply$2.apply$mcV$sp(LogManager.scala:292)
>  at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:61) at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at 
> java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  at java.lang.Thread.run(Thread.java:748)
> [https://github.com/apache/kafka/blob/1.0/core/src/main/scala/kafka/log/LogConfig.scala#L100]
> So the minimum value shouldn't be 0
> https://kafka.apache.org/documentation/#topicconfigs



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KAFKA-6637) if set topic config segment.ms=0 Kafka broker won't be able to start

2018-03-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-6637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396711#comment-16396711
 ] 

ASF GitHub Bot commented on KAFKA-6637:
---

huxihx opened a new pull request #4698: KAFKA-6637: Avoid divide /zero error 
with segment.ms set to zero
URL: https://github.com/apache/kafka/pull/4698
 
 
   https://issues.apache.org/jira/browse/KAFKA-6637
   
   Changes of this patch include:
   1. Avoid divide /zero error with segment.ms set to zero
   2. Ignore the effect of setting `log.roll.ms` to zero. Use `log.roll.hours` 
instead
   
   *More detailed description of your change,
   if necessary. The PR title and PR message become
   the squashed commit message, so use a separate
   comment to ping reviewers.*
   
   *Summary of testing strategy (including rationale)
   for the feature or bug fix. Unit and/or integration
   tests are expected for any behaviour change and
   system tests should be considered for larger changes.*
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> if set topic config segment.ms=0 Kafka broker won't be able to start
> 
>
> Key: KAFKA-6637
> URL: https://issues.apache.org/jira/browse/KAFKA-6637
> Project: Kafka
>  Issue Type: Bug
>Affects Versions: 1.0.0
>Reporter: Chong Wang
>Assignee: huxihx
>Priority: Major
>
> If set topic config segment.ms to 0, Kafka server won't be able to start 
> because of a FATAL error:
> [2018-03-12 19:05:40,196] FATAL [KafkaServer id=2] Fatal error during 
> KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) 
> java.lang.ArithmeticException: / by zero at 
> kafka.log.LogConfig.randomSegmentJitter(LogConfig.scala:100) at 
> kafka.log.Log.loadSegments(Log.scala:419) at 
> kafka.log.Log.(Log.scala:203) at kafka.log.Log$.apply(Log.scala:1734) 
> at kafka.log.LogManager.kafka$log$LogManager$$loadLog(LogManager.scala:221) 
> at 
> kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$8$$anonfun$apply$16$$anonfun$apply$2.apply$mcV$sp(LogManager.scala:292)
>  at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:61) at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at 
> java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  at java.lang.Thread.run(Thread.java:748)
> [https://github.com/apache/kafka/blob/1.0/core/src/main/scala/kafka/log/LogConfig.scala#L100]
> So the minimum value shouldn't be 0
> https://kafka.apache.org/documentation/#topicconfigs



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KAFKA-6637) if set topic config segment.ms=0 Kafka broker won't be able to start

2018-03-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-6637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396622#comment-16396622
 ] 

ASF GitHub Bot commented on KAFKA-6637:
---

huxihx closed pull request #4697: KAFKA-6637: Avoid divide by zero exception 
when segment.ms is set to 0
URL: https://github.com/apache/kafka/pull/4697
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/scala/kafka/log/LogConfig.scala 
b/core/src/main/scala/kafka/log/LogConfig.scala
index 30ca333dd28..2a941bc4196 100755
--- a/core/src/main/scala/kafka/log/LogConfig.scala
+++ b/core/src/main/scala/kafka/log/LogConfig.scala
@@ -98,7 +98,7 @@ case class LogConfig(props: java.util.Map[_, _], 
overriddenConfigs: Set[String]
   val FollowerReplicationThrottledReplicas = 
getList(LogConfig.FollowerReplicationThrottledReplicasProp)
 
   def randomSegmentJitter: Long =
-if (segmentJitterMs == 0) 0 else Utils.abs(scala.util.Random.nextInt()) % 
math.min(segmentJitterMs, segmentMs)
+if (segmentJitterMs == 0 || segmentMs == 0) 0 else 
Utils.abs(scala.util.Random.nextInt()) % math.min(segmentJitterMs, segmentMs)
 }
 
 object LogConfig {
diff --git a/core/src/main/scala/kafka/server/KafkaConfig.scala 
b/core/src/main/scala/kafka/server/KafkaConfig.scala
index cf22305caf7..e35d188e943 100755
--- a/core/src/main/scala/kafka/server/KafkaConfig.scala
+++ b/core/src/main/scala/kafka/server/KafkaConfig.scala
@@ -1088,7 +1088,10 @@ class KafkaConfig(val props: java.util.Map[_, _], doLog: 
Boolean, dynamicConfigO
   def logIndexSizeMaxBytes = getInt(KafkaConfig.LogIndexSizeMaxBytesProp)
   def logIndexIntervalBytes = getInt(KafkaConfig.LogIndexIntervalBytesProp)
   def logDeleteDelayMs = getLong(KafkaConfig.LogDeleteDelayMsProp)
-  def logRollTimeMillis: java.lang.Long = 
Option(getLong(KafkaConfig.LogRollTimeMillisProp)).getOrElse(60 * 60 * 1000L * 
getInt(KafkaConfig.LogRollTimeHoursProp))
+  def logRollTimeMillis: java.lang.Long = 
Option(getLong(KafkaConfig.LogRollTimeMillisProp)) match {
+  case Some(rollMs) if rollMs > 0 => rollMs
+  case _ => 60 * 60 * 1000L * getInt(KafkaConfig.LogRollTimeHoursProp)
+  }
   def logRollTimeJitterMillis: java.lang.Long = 
Option(getLong(KafkaConfig.LogRollTimeJitterMillisProp)).getOrElse(60 * 60 * 
1000L * getInt(KafkaConfig.LogRollTimeJitterHoursProp))
   def logFlushIntervalMs: java.lang.Long = 
Option(getLong(KafkaConfig.LogFlushIntervalMsProp)).getOrElse(getLong(KafkaConfig.LogFlushSchedulerIntervalMsProp))
   def minInSyncReplicas = getInt(KafkaConfig.MinInSyncReplicasProp)


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> if set topic config segment.ms=0 Kafka broker won't be able to start
> 
>
> Key: KAFKA-6637
> URL: https://issues.apache.org/jira/browse/KAFKA-6637
> Project: Kafka
>  Issue Type: Bug
>Affects Versions: 1.0.0
>Reporter: Chong Wang
>Assignee: huxihx
>Priority: Major
>
> If set topic config segment.ms to 0, Kafka server won't be able to start 
> because of a FATAL error:
> [2018-03-12 19:05:40,196] FATAL [KafkaServer id=2] Fatal error during 
> KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) 
> java.lang.ArithmeticException: / by zero at 
> kafka.log.LogConfig.randomSegmentJitter(LogConfig.scala:100) at 
> kafka.log.Log.loadSegments(Log.scala:419) at 
> kafka.log.Log.(Log.scala:203) at kafka.log.Log$.apply(Log.scala:1734) 
> at kafka.log.LogManager.kafka$log$LogManager$$loadLog(LogManager.scala:221) 
> at 
> kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$8$$anonfun$apply$16$$anonfun$apply$2.apply$mcV$sp(LogManager.scala:292)
>  at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:61) at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at 
> java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  at java.lang.Thread.run(Thread.java:748)
> [https://github.com/apache/kafka/blob/1.0/core/src/main/scala/kafka/log/LogConfig.scala#L100]
> So the minimum value shouldn't be 0
> https://kafka.apache.org/documentation/#topicconfigs



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)