Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-5104

DumpLogSegments should not open index files with `rw`

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.10.2.0
    • 0.11.0.0
    • log
    • None
    • Kafka is run as root

    Description

      kafka.tools.DumpLogSegments requires sudo for index files but not for log files. It seems inconsistent why `w` access would be required for the index files just to dump the output.

      $ sudo kafka-run-class kafka.tools.DumpLogSegments  --files 00000000000000000000.index
      Dumping 00000000000000000000.index
      offset: 0 position: 0
      
      $ kafka-run-class kafka.tools.DumpLogSegments  --files 00000000000000000000.indexDumping 00000000000000000000.index
      Exception in thread "main" java.io.FileNotFoundException: 00000000000000000000.index (Permission denied)
          at java.io.RandomAccessFile.open0(Native Method)
          at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
          at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
          at kafka.log.AbstractIndex.<init>(AbstractIndex.scala:50)
          at kafka.log.OffsetIndex.<init>(OffsetIndex.scala:52)
          at kafka.tools.DumpLogSegments$.kafka$tools$DumpLogSegments$$dumpIndex(DumpLogSegments.scala:137)
          at kafka.tools.DumpLogSegments$$anonfun$main$1.apply(DumpLogSegments.scala:100)
          at kafka.tools.DumpLogSegments$$anonfun$main$1.apply(DumpLogSegments.scala:93)
          at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
          at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
          at kafka.tools.DumpLogSegments$.main(DumpLogSegments.scala:93)
          at kafka.tools.DumpLogSegments.main(DumpLogSegments.scala)
      

      Attachments

        Issue Links

          Activity

            People

              huxi_2b huxihx
              yevabyzek Yeva Byzek
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: