kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject svn commit: r1163929 - /incubator/kafka/trunk/core/src/main/scala/kafka/tools/DumpLogSegments.scala
Date Thu, 01 Sep 2011 07:49:32 GMT
Author: junrao
Date: Thu Sep  1 07:49:31 2011
New Revision: 1163929

URL: http://svn.apache.org/viewvc?rev=1163929&view=rev
Log:
DumpLogSegments outputs wrong offsets; kafka-128 patched by junrao; reviewed by Joel

Modified:
    incubator/kafka/trunk/core/src/main/scala/kafka/tools/DumpLogSegments.scala

Modified: incubator/kafka/trunk/core/src/main/scala/kafka/tools/DumpLogSegments.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/main/scala/kafka/tools/DumpLogSegments.scala?rev=1163929&r1=1163928&r2=1163929&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/main/scala/kafka/tools/DumpLogSegments.scala (original)
+++ incubator/kafka/trunk/core/src/main/scala/kafka/tools/DumpLogSegments.scala Thu Sep  1
07:49:31 2011
@@ -33,15 +33,16 @@ object DumpLogSegments {
       if (! ("-noprint".compareToIgnoreCase(arg) == 0) ) {
         val file = new File(arg)
         println("Dumping " + file)
-        var offset = file.getName().split("\\.")(0).toLong
-        println("Starting offset: " + offset)
+        val startOffset = file.getName().split("\\.")(0).toLong
+        var offset = 0L
+        println("Starting offset: " + startOffset)
         val messageSet = new FileMessageSet(file, false)
         for(messageAndOffset <- messageSet) {
           val msg = messageAndOffset.message
-          println("offset: " + offset + " isvalid: " + msg.isValid + " magic: " + msg.magic
+ " compresscodec: " + msg.compressionCodec)
+          println("offset: " + (startOffset + offset) + " isvalid: " + msg.isValid + " magic:
" + msg.magic + " compresscodec: " + msg.compressionCodec)
           if (!isNoPrint)
             println("payload:\t" + Utils.toString(messageAndOffset.message.payload, "UTF-8"))
-          offset += messageAndOffset.offset
+          offset = messageAndOffset.offset
         }
       }
     }



Mime
View raw message