kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [kafka] branch 1.0 updated: MINOR: Use log start offset as high watermark if current value is out of range (#4722)
Date Sun, 18 Mar 2018 18:28:34 GMT
This is an automated email from the ASF dual-hosted git repository.

jgus pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/1.0 by this push:
     new 7e594ee  MINOR: Use log start offset as high watermark if current value is out of
range (#4722)
7e594ee is described below

commit 7e594eead2503f906d4b37fe9dffeb9b576d06e3
Author: Dong Lin <lindong28@users.noreply.github.com>
AuthorDate: Sun Mar 18 11:21:44 2018 -0700

    MINOR: Use log start offset as high watermark if current value is out of range (#4722)
    
    Reviewers: Jun Rao <junrao@gmail.com>, Jason Gustafson <jason@confluent.io>
---
 core/src/main/scala/kafka/cluster/Replica.scala | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/core/src/main/scala/kafka/cluster/Replica.scala b/core/src/main/scala/kafka/cluster/Replica.scala
index 979bc30..a658458 100644
--- a/core/src/main/scala/kafka/cluster/Replica.scala
+++ b/core/src/main/scala/kafka/cluster/Replica.scala
@@ -175,8 +175,10 @@ class Replica(val brokerId: Int,
   def convertHWToLocalOffsetMetadata() {
     if (isLocal) {
       highWatermarkMetadata = log.get.convertToOffsetMetadata(highWatermarkMetadata.messageOffset).getOrElse
{
-        val firstOffset = log.get.logSegments.head.baseOffset
-        new LogOffsetMetadata(firstOffset, firstOffset, 0)
+        log.get.convertToOffsetMetadata(logStartOffset).getOrElse {
+          val firstSegmentOffset = log.get.logSegments.head.baseOffset
+          new LogOffsetMetadata(firstSegmentOffset, firstSegmentOffset, 0)
+        }
       }
     } else {
       throw new KafkaException(s"Should not construct complete high watermark on partition
$topicPartition's non-local replica $brokerId")

-- 
To stop receiving notification emails like this one, please contact
jgus@apache.org.

Mime
View raw message