KAFKA-132 Patch from Scott Andreas to avoid flush when there is nothing to flush. Looks like due to atime attribute in the filesystem this can lead to flushing file metadata.

git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/trunk@1171889 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Edward Jay Kreps 2011-09-17 03:31:15 +00:00
parent 54f49314af
commit 8efb536aff
1 changed files with 3 additions and 1 deletions

View File

@ -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: " +