kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject svn commit: r1406004 - /incubator/kafka/branches/0.8/core/src/main/scala/kafka/log/LogSegment.scala
Date Mon, 05 Nov 2012 23:10:39 GMT
Author: junrao
Date: Mon Nov  5 23:10:38 2012
New Revision: 1406004

URL: http://svn.apache.org/viewvc?rev=1406004&view=rev
Log:
LogSegment.firstAppendTime not reset after truncate to; patched by Swapnil Ghike; reviewed
by Jun Rao, Neha Narkhede; KAFKA-596

Modified:
    incubator/kafka/branches/0.8/core/src/main/scala/kafka/log/LogSegment.scala

Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/log/LogSegment.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/log/LogSegment.scala?rev=1406004&r1=1406003&r2=1406004&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/log/LogSegment.scala (original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/log/LogSegment.scala Mon Nov  5
23:10:38 2012
@@ -20,7 +20,11 @@ class LogSegment(val messageSet: FileMes
                  val indexIntervalBytes: Int,
                  time: Time) extends Range with Logging {
   
-  var firstAppendTime: Option[Long] = None
+  var firstAppendTime: Option[Long] =
+    if (messageSet.sizeInBytes > 0)
+      Some(time.milliseconds)
+    else
+      None
   
   /* the number of bytes since we last added an entry in the offset index */
   var bytesSinceLastIndexEntry = 0
@@ -118,6 +122,8 @@ class LogSegment(val messageSet: FileMes
       return
     index.truncateTo(offset)  
     messageSet.truncateTo(mapping.position)
+    if (messageSet.sizeInBytes == 0)
+      firstAppendTime = None
   }
   
   /**



Mime
View raw message