Github user Ethanlm commented on a diff in the pull request: https://github.com/apache/storm/pull/2754#discussion_r208691270 --- Diff: storm-webapp/src/main/java/org/apache/storm/daemon/logviewer/handler/LogviewerLogSearchHandler.java --- @@ -388,63 +414,83 @@ private Integer tryParseIntParam(String paramName, String value) throws InvalidR } } + /** + * Find the first N matches of target string in files. + * @param logs all candidate log files to search + * @param numMatches number of matches expected + * @param fileOffset Unclear metrics + * @param startByteOffset number of byte to be ignored in each log file + * @param targetStr searched string + * @return all matched results + */ @VisibleForTesting - Matched findNMatches(List<File> logs, int numMatches, int fileOffset, int offset, String search) { + Matched findNMatches(List<File> logs, int numMatches, int fileOffset, int startByteOffset, String targetStr) { logs = drop(logs, fileOffset); + LOG.debug("{} files to scan", logs.size()); List<Map<String, Object>> matches = new ArrayList<>(); int matchCount = 0; + int scannedFiles = 0; + //TODO: Unnecessarily convoluted loop that should be optimized --- End diff -- remove comment
---