Skip to content

Commit

Permalink
Reflect review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartSaVioR committed Nov 10, 2019
1 parent 5f6c43d commit cff732c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
Expand Down

0 comments on commit cff732c

Please sign in to comment.