Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-17674

Major compaction may be cancelled in CompactionChecker

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.0, 1.2.4, 0.98.24, 2.0.0
    • 1.4.0, 2.0.0
    • Compaction
    • None
    • Reviewed

    Description

      CompactionChecker will periodically check whether a region should perform a major compaction.
      If a region should perform a major compact, a request is submitted. But before the request is submitted, the variable forceMajor is not set to true by calling triggerMajorCompaction.
      When filtering a storefile, the large storefile may cause the request to be canceled or became minor compact.

      HRegionServer.java
      @Override
          protected void chore() {
            for (Region r : this.instance.onlineRegions.values()) {
              if (r == null)
                continue;
              for (Store s : r.getStores()) {
                try {
                  long multiplier = s.getCompactionCheckMultiplier();
                  assert multiplier > 0;
                  if (iteration % multiplier != 0) continue;
                  if (s.needsCompaction()) {
                    // Queue a compaction. Will recognize if major is needed.
                    this.instance.compactSplitThread.requestSystemCompaction(r, s, getName()
                        + " requests compaction");
                  } else if (s.isMajorCompaction()) {              
                    if (majorCompactPriority == DEFAULT_PRIORITY
                        || majorCompactPriority > ((HRegion)r).getCompactPriority()) {
                      this.instance.compactSplitThread.requestCompaction(r, s, getName()
                          + " requests major compaction; use default priority", null);
                    } else {
                      this.instance.compactSplitThread.requestCompaction(r, s, getName()
                          + " requests major compaction; use configured priority",
                        this.majorCompactPriority, null, null);
                    }
                  }
                } catch (IOException e) {
                  LOG.warn("Failed major compaction check on " + r, e);
                }
              }
            }
            iteration = (iteration == Long.MAX_VALUE) ? 0 : (iteration + 1);
          }
      

      Attachments

        1. HBASE-17674-master-v1.patch
          0.9 kB
          Guangxu Cheng

        Activity

          People

            gxcheng Guangxu Cheng
            gxcheng Guangxu Cheng
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: