Yeva Byzek created KAFKA-5104:
---------------------------------
Summary: DumpLogSegments should not open index files with `rw`
Key: KAFKA-5104
URL: https://issues.apache.org/jira/browse/KAFKA-5104
Project: Kafka
Issue Type: Improvement
Components: log
Affects Versions: 0.10.2.0
Environment: Kafka is run as root
Reporter: Yeva Byzek
Priority: Minor
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.
{noformat}
$ sudo kafka-run-class kafka.tools.DumpLogSegments --files
00000000000000000000.index
Dumping 00000000000000000000.index
offset: 0 position: 0
{noformat}
{noformat}
$ 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)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)