Browse Source

LogSegment.firstAppendTime not reset after truncate to; patched by Swapnil Ghike; reviewed by Jun Rao, Neha Narkhede; KAFKA-596

git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1406004 13f79535-47bb-0310-9956-ffa450edef68
0.8.0-beta1-candidate1
Jun Rao 12 years ago
parent
commit
989c9bfbab
  1. 8
      core/src/main/scala/kafka/log/LogSegment.scala

8
core/src/main/scala/kafka/log/LogSegment.scala

@ -20,7 +20,11 @@ class LogSegment(val messageSet: FileMessageSet, @@ -20,7 +20,11 @@ class LogSegment(val messageSet: FileMessageSet,
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: FileMessageSet, @@ -118,6 +122,8 @@ class LogSegment(val messageSet: FileMessageSet,
return
index.truncateTo(offset)
messageSet.truncateTo(mapping.position)
if (messageSet.sizeInBytes == 0)
firstAppendTime = None
}
/**

Loading…
Cancel
Save