You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jk...@apache.org on 2011/09/17 05:31:15 UTC

svn commit: r1171889 - /incubator/kafka/trunk/core/src/main/scala/kafka/log/Log.scala

Author: jkreps
Date: Sat Sep 17 03:31:15 2011
New Revision: 1171889

URL: http://svn.apache.org/viewvc?rev=1171889&view=rev
Log:
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.


Modified:
    incubator/kafka/trunk/core/src/main/scala/kafka/log/Log.scala

Modified: incubator/kafka/trunk/core/src/main/scala/kafka/log/Log.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/main/scala/kafka/log/Log.scala?rev=1171889&r1=1171888&r2=1171889&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/main/scala/kafka/log/Log.scala (original)
+++ incubator/kafka/trunk/core/src/main/scala/kafka/log/Log.scala Sat Sep 17 03:31:15 2011
@@ -298,7 +298,9 @@ private[log] class Log(val dir: File, va
   /**
    * 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: " +