Package org.apache.accumulo.tserver.compaction

Examples of org.apache.accumulo.tserver.compaction.MajorCompactionRequest


    Map<FileRef,Pair<Key,Key>> firstAndLastKeys = null;
    if (reason == MajorCompactionReason.CHOP) {
      firstAndLastKeys = getFirstAndLastKeys(datafileManager.getDatafileSizes());
    } else if (reason != MajorCompactionReason.USER) {
      MajorCompactionRequest request = new MajorCompactionRequest(extent, reason, fs, acuTableConf);
      request.setFiles(datafileManager.getDatafileSizes());
      strategy.gatherInformation(request);
    }

    Map<FileRef,DataFileValue> filesToCompact;

    int maxFilesToCompact = acuTableConf.getCount(Property.TSERV_MAJC_THREAD_MAXOPEN);

    CompactionStats majCStats = new CompactionStats();
    CompactionPlan plan = null;

    boolean propogateDeletes = false;

    synchronized (this) {
      // plan all that work that needs to be done in the sync block... then do the actual work
      // outside the sync block

      t1 = System.currentTimeMillis();

      majorCompactionWaitingToStart = true;

      tabletMemory.waitForMinC();

      t2 = System.currentTimeMillis();

      majorCompactionWaitingToStart = false;
      notifyAll();

      if (extent.isRootTablet()) {
        // very important that we call this before doing major compaction,
        // otherwise deleted compacted files could possible be brought back
        // at some point if the file they were compacted to was legitimately
        // removed by a major compaction
        RootFiles.cleanupReplacement(fs, fs.listStatus(this.location), false);
      }
      SortedMap<FileRef,DataFileValue> allFiles = datafileManager.getDatafileSizes();
      List<FileRef> inputFiles = new ArrayList<FileRef>();
      if (reason == MajorCompactionReason.CHOP) {
        // enforce rules: files with keys outside our range need to be compacted
        inputFiles.addAll(findChopFiles(extent, firstAndLastKeys, allFiles.keySet()));
      } else if (reason == MajorCompactionReason.USER) {
        inputFiles.addAll(allFiles.keySet());
      } else {
        MajorCompactionRequest request = new MajorCompactionRequest(extent, reason, fs, acuTableConf);
        request.setFiles(allFiles);
        plan = strategy.getCompactionPlan(request);
        if (plan != null)
          inputFiles.addAll(plan.inputFiles);
      }
View Full Code Here


        }
      }
      CompactionStrategy strategy = Property.createInstanceFromPropertyName(tableConf, Property.TABLE_COMPACTION_STRATEGY, CompactionStrategy.class,
          new DefaultCompactionStrategy());
      strategy.init(Property.getCompactionStrategyOptions(tableConf));
      MajorCompactionRequest request = new MajorCompactionRequest(tablet.getExtent(), reason, TabletServerResourceManager.this.fs, tableConf);
      request.setFiles(tabletFiles);
      try {
        return strategy.shouldCompact(request);
      } catch (IOException ex) {
        return false;
      }
View Full Code Here

    Map<FileRef,Pair<Key,Key>> firstAndLastKeys = null;
    if (reason == MajorCompactionReason.CHOP) {
      firstAndLastKeys = getFirstAndLastKeys(datafileManager.getDatafileSizes());
    } else if (reason != MajorCompactionReason.USER) {
      MajorCompactionRequest request = new MajorCompactionRequest(extent, reason, fs, acuTableConf);
      request.setFiles(datafileManager.getDatafileSizes());
      strategy.gatherInformation(request);
    }

    Map<FileRef,DataFileValue> filesToCompact;

    int maxFilesToCompact = acuTableConf.getCount(Property.TSERV_MAJC_THREAD_MAXOPEN);

    CompactionStats majCStats = new CompactionStats();
    CompactionPlan plan = null;

    boolean propogateDeletes = false;

    synchronized (this) {
      // plan all that work that needs to be done in the sync block... then do the actual work
      // outside the sync block

      t1 = System.currentTimeMillis();

      majorCompactionWaitingToStart = true;

      tabletMemory.waitForMinC();

      t2 = System.currentTimeMillis();

      majorCompactionWaitingToStart = false;
      notifyAll();

      if (extent.isRootTablet()) {
        // very important that we call this before doing major compaction,
        // otherwise deleted compacted files could possible be brought back
        // at some point if the file they were compacted to was legitimately
        // removed by a major compaction
        RootFiles.cleanupReplacement(fs, fs.listStatus(this.location), false);
      }
      SortedMap<FileRef,DataFileValue> allFiles = datafileManager.getDatafileSizes();
      List<FileRef> inputFiles = new ArrayList<FileRef>();
      if (reason == MajorCompactionReason.CHOP) {
        // enforce rules: files with keys outside our range need to be compacted
        inputFiles.addAll(findChopFiles(extent, firstAndLastKeys, allFiles.keySet()));
      } else if (reason == MajorCompactionReason.USER) {
        inputFiles.addAll(allFiles.keySet());
      } else {
        MajorCompactionRequest request = new MajorCompactionRequest(extent, reason, fs, acuTableConf);
        request.setFiles(allFiles);
        plan = strategy.getCompactionPlan(request);
        if (plan != null)
          inputFiles.addAll(plan.inputFiles);
      }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.tserver.compaction.MajorCompactionRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.