accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubbsii <...@git.apache.org>
Subject [GitHub] accumulo pull request #159: ACCUMULO-1280: many changes for closing iterator...
Date Mon, 17 Oct 2016 22:00:36 GMT
Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/159#discussion_r83743192
  
    --- Diff: server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java
---
    @@ -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(), entriesCompacted);
    +        CompactionStats lgMajcStats = new CompactionStats(statsCount, entriesCompacted);
    --- 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message