Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/224#discussion_r105247760
  
    --- Diff: 
server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategy.java
 ---
    @@ -48,6 +53,83 @@ void gatherInformation(MajorCompactionRequest request) {}
         abstract boolean shouldCompact(Entry<FileRef,DataFileValue> file, 
MajorCompactionRequest request);
       }
     
    +  private static class SummaryTest extends Test {
    +
    +    private boolean selectExtraSummary;
    +    private boolean selectNoSummary;
    +
    +    private boolean summaryConfigured = true;
    +    private boolean gatherCalled = false;
    +
    +    // files that do not need compaction
    +    private Set<FileRef> okFiles = Collections.emptySet();
    +
    +    public SummaryTest(boolean selectExtraSummary, boolean 
selectNoSummary) {
    +      this.selectExtraSummary = selectExtraSummary;
    +      this.selectNoSummary = selectNoSummary;
    +    }
    +
    +    @Override
    +    void gatherInformation(MajorCompactionRequest request) {
    +      gatherCalled = true;
    +      Collection<SummarizerConfiguration> configs = 
SummarizerConfiguration.fromTableProperties(request.getTableProperties());
    +      if (configs.size() == 0) {
    +        summaryConfigured = false;
    +      } else {
    +        Set<SummarizerConfiguration> configsSet = configs instanceof Set ? 
(Set<SummarizerConfiguration>) configs : new HashSet<>(configs);
    +
    +        for (FileRef fref : request.getFiles().keySet()) {
    +          Map<SummarizerConfiguration,Summary> sMap = new HashMap<>();
    +          Collection<Summary> summaries;
    +          try {
    +            summaries = 
request.getSummaries(Collections.singletonList(fref), conf -> 
configsSet.contains(conf));
    +          } catch (IOException e) {
    +            throw new UncheckedIOException(e);
    +          }
    +          for (Summary summary : summaries) {
    +            sMap.put(summary.getSummarizerConfiguration(), summary);
    +          }
    +
    +          boolean needsCompaction = false;
    +          for (SummarizerConfiguration sc : configs) {
    +            Summary summary = sMap.get(sc);
    +
    +            if (summary == null && selectNoSummary) {
    +              needsCompaction = true;
    +              break;
    +            }
    +
    +            if (summary != null && summary.getFileStatistics().getExtra() 
> 0 && selectExtraSummary) {
    +              needsCompaction = true;
    +              break;
    +            }
    +          }
    +
    +          if (!needsCompaction) {
    +            okFiles.add(fref);
    --- End diff --
    
    It looks like `okFiles` is only set once (to `Collections.emptyMap()`). 
Isn't the `Map` returned by that method immutable?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to