From cff732c4920134f52b2c7700eeb66df86c3f9ad0 Mon Sep 17 00:00:00 2001 From: "Jungtaek Lim (HeartSaVioR)" Date: Sun, 10 Nov 2019 14:04:10 +0900 Subject: [PATCH] Reflect review comments --- .../spark/deploy/history/EventLogFileCompactor.scala | 8 ++------ .../apache/spark/deploy/history/EventLogFileReaders.scala | 7 +------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileCompactor.scala b/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileCompactor.scala index 22871a1fcfd17..291170941b2ca 100644 --- a/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileCompactor.scala +++ b/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileCompactor.scala @@ -101,12 +101,7 @@ class EventLogFileCompactor( val lastCompactedFileIdx = eventLogFiles.lastIndexWhere { fs => EventLogFileWriter.isCompacted(fs.getPath) } - - val files = if (lastCompactedFileIdx > -1) { - eventLogFiles.drop(lastCompactedFileIdx) - } else { - eventLogFiles - } + val files = eventLogFiles.drop(lastCompactedFileIdx) if (files.length > maxFilesToRetain) { (files.dropRight(maxFilesToRetain), files.takeRight(maxFilesToRetain)) @@ -233,6 +228,7 @@ class CompactedEventLogFileWriter( override val logPath: String = originalFilePath.toUri.toString + EventLogFileWriter.COMPACTED + // override to make writeLine method be 'public' only for this class override def writeLine(line: String, flushLogger: Boolean): Unit = { super.writeLine(line, flushLogger) } diff --git a/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileReaders.scala b/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileReaders.scala index 88cbeccab8e25..597fd3f2671f9 100644 --- a/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileReaders.scala +++ b/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileReaders.scala @@ -231,12 +231,7 @@ class RollingEventLogFilesFileReader( val lastCompactedFileIdx = eventLogFiles.lastIndexWhere { fs => EventLogFileWriter.isCompacted(fs.getPath) } - - val filesToRead = if (lastCompactedFileIdx > -1) { - eventLogFiles.drop(lastCompactedFileIdx) - } else { - eventLogFiles - } + val filesToRead = eventLogFiles.drop(lastCompactedFileIdx) val indices = filesToRead.map { file => getIndex(file.getPath.getName) } require((indices.head to indices.last) == indices, "Found missing event log file, expected" +