kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nehanarkh...@apache.org
Subject git commit: KAFKA-1009 DumpLogSegments tool should return error on non-existing files; reviewed by Neha Narkhede
Date Mon, 19 Aug 2013 16:45:57 GMT
Updated Branches:
  refs/heads/trunk df18fe13a -> ff6292904


KAFKA-1009 DumpLogSegments tool should return error on non-existing files; reviewed by Neha
Narkhede


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/ff629290
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/ff629290
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/ff629290

Branch: refs/heads/trunk
Commit: ff6292904a67cd021d365ef1e07c113002b80582
Parents: df18fe1
Author: Guozhang Wang <guwang@linkedin.com>
Authored: Mon Aug 19 09:45:39 2013 -0700
Committer: Neha Narkhede <neha.narkhede@gmail.com>
Committed: Mon Aug 19 09:45:48 2013 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/log/FileMessageSet.scala    | 5 +++++
 core/src/main/scala/kafka/tools/DumpLogSegments.scala | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/ff629290/core/src/main/scala/kafka/log/FileMessageSet.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/log/FileMessageSet.scala b/core/src/main/scala/kafka/log/FileMessageSet.scala
index 2479a5f..6c099da 100644
--- a/core/src/main/scala/kafka/log/FileMessageSet.scala
+++ b/core/src/main/scala/kafka/log/FileMessageSet.scala
@@ -67,6 +67,11 @@ class FileMessageSet private[kafka](@volatile var file: File,
    */
   def this(file: File) = 
     this(file, Utils.openChannel(file, mutable = true))
+
+  /**
+   * Create a file message set with mutable option
+   */
+  def this(file: File, mutable: Boolean) = this(file, Utils.openChannel(file, mutable))
   
   /**
    * Create a slice view of the file message set that begins and ends at the given byte offsets

http://git-wip-us.apache.org/repos/asf/kafka/blob/ff629290/core/src/main/scala/kafka/tools/DumpLogSegments.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/tools/DumpLogSegments.scala b/core/src/main/scala/kafka/tools/DumpLogSegments.scala
index 5231e7c..89b6cb1 100644
--- a/core/src/main/scala/kafka/tools/DumpLogSegments.scala
+++ b/core/src/main/scala/kafka/tools/DumpLogSegments.scala
@@ -94,7 +94,7 @@ object DumpLogSegments {
     val startOffset = file.getName().split("\\.")(0).toLong
     val logFileName = file.getAbsolutePath.split("\\.")(0) + Log.LogFileSuffix
     val logFile = new File(logFileName)
-    val messageSet = new FileMessageSet(logFile)
+    val messageSet = new FileMessageSet(logFile, false)
     val index = new OffsetIndex(file = file, baseOffset = startOffset)
     for(i <- 0 until index.entries) {
       val entry = index.entry(i)
@@ -120,7 +120,7 @@ object DumpLogSegments {
                       isDeepIteration: Boolean) {
     val startOffset = file.getName().split("\\.")(0).toLong
     println("Starting offset: " + startOffset)
-    val messageSet = new FileMessageSet(file)
+    val messageSet = new FileMessageSet(file, false)
     var validBytes = 0L
     var lastOffset = -1l
     for(shallowMessageAndOffset <- messageSet) { // this only does shallow iteration


Mime
View raw message