xkrogen commented on code in PR #5215: URL: https://github.com/apache/hadoop/pull/5215#discussion_r1047905288
########## hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/log/LogThrottlingHelper.java: ########## @@ -262,8 +263,15 @@ public LogAction record(String recorderName, long currentTimeMs, if (primaryRecorderName.equals(recorderName) && currentTimeMs - minLogPeriodMs >= lastLogTimestampMs) { lastLogTimestampMs = currentTimeMs; - for (LoggingAction log : currentLogs.values()) { - log.setShouldLog(); + for (Iterator<LoggingAction> it = currentLogs.values().iterator(); it + .hasNext();) { + LoggingAction log = it.next(); + if (log.hasLogged()) { + // Make sure the dependent recorders will be triggered the next time + it.remove(); + } else { + log.setShouldLog(); + } } Review Comment: This does solve the issue but it feels a bit awkward/confusing to me. Having no entry in `currentLogs` is supposed to indicate that this `recoderName` has never been seen before. What do you think about this instead: ```suggestion currentLogs.replaceAll((k, log) -> { LoggingAction newLog = log; if (log.hasLogged()) { // create a fresh log since the old one has already been logged newLog = new LoggingAction(log.getValueCount()); } newLog.setShouldLog(); return newLog; }); ``` I feel it's a bit more explicit/clear about what we're achieving. WDYT? (note that this also requires creating a new method in `LoggingAction` to expose the value count like `private int getValueCount() { return stats.length; }`) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org