accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <...@git.apache.org>
Subject [GitHub] accumulo pull request #224: ACCUMULO-4500 ACCUMULO-96 Added summarization
Date Mon, 13 Mar 2017 15:07:46 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/224#discussion_r105683470
  
    --- 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 --
    
    Yikes!  Thats a really nice find.


---
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