Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/2315#discussion_r138088942 --- Diff: external/storm-hdfs/src/main/java/org/apache/storm/hdfs/bolt/AbstractHdfsBolt.java --- @@ -317,7 +319,18 @@ public WritersMap(long maxWriters) { @Override protected boolean removeEldestEntry(Map.Entry<String, Writer> eldest) { - return this.size() > this.maxWriters; + if (this.size() > this.maxWriters) { + //The writer must be closed before removed from the map. + //If it failed, we might lose some data. + try { + eldest.getValue().close(); + } catch (IOException e) { + LOG.error("Failed to close the eldest Writer"); --- End diff -- Would it be possible to report the error here like we do in other places in the code? ``` this.collector.reportError(e); ``` It would also be create if you could add it to `doRotationAndRemoveAllWriters` too just so it is consistent everywhere.
---