Github user ctubbsii commented on a diff in the pull request:
    --- Diff: 
    @@ -388,9 +389,10 @@ else if (env.getIteratorScope() == IteratorScope.minc)
               throw new CompactionCanceledException();
    +      } catch (Exception e) {
    +        throw new IOException(e);
           } finally {
    -        CompactionStats lgMajcStats = new CompactionStats(citr.getCount(), 
    +        CompactionStats lgMajcStats = new CompactionStats(statsCount, 
    --- End diff --
    Careful about suppressed exceptions here, especially when using multiple 
resources in a single try-with-resources, and mixing try-with-resources with a 
finally block. Any exception thrown in the finally block will suppress 
try-with-resources, and exception from closing one resource may result in 
others being suppressed.
    How do we want to handle suppressed exceptions? Do we assume they've 
already been logged earlier, or do we try to handle them here? Wrapping 
`Exception e` with `IOException` may also make it more difficult for the caller 
to track the suppressed exceptions attached to `e`, which is now in the 
`getCause()` of the `IOException`.
    Also, statsCount might be stale (or uninitialized) in the finally block if 
an exception occurs in the try block.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

Reply via email to