diff --git a/core/src/main/scala/kafka/log/Log.scala b/core/src/main/scala/kafka/log/Log.scala index d4c074d33f4..c403770cd79 100644 --- a/core/src/main/scala/kafka/log/Log.scala +++ b/core/src/main/scala/kafka/log/Log.scala @@ -298,7 +298,9 @@ private[log] class Log(val dir: File, val maxSize: Long, val flushInterval: Int, /** * Flush this log file to the physical disk */ - def flush() = { + def flush() : Unit = { + if (unflushed.get == 0) return + lock synchronized { if(logger.isDebugEnabled) logger.debug("Flushing log '" + name + "' last flushed: " + getLastFlushedTime + " current time: " +