public void compact(boolean majorCompaction) throws IOException {
    if (majorCompaction) {
      stores.values().forEach(HStore::triggerMajorCompaction);
    }
    for (HStore s : stores.values()) {
      Optional<CompactionContext> compaction = s.requestCompaction();
      if (compaction.isPresent()) {
        ThroughputController controller = null;
        if (rsServices != null) {
          controller = CompactionThroughputControllerFactory.create(rsServices, conf);
        }
        if (controller == null) {
          controller = NoLimitThroughputController.INSTANCE;
        }
        compact(compaction.get(), s, controller, null);
      }
    }
  }
Synchronously compact all stores in the region.
<p>
This operation could block for a long time, so don't call it from a time-sensitive thread.
<p>
Note that no locks are taken to prevent possible conflicts between compaction and splitting
activities. The regionserver does not normally compact and split in parallel. However by
calling this method you may introduce unexpected and unhandled concurrency. Don't do this
unless you know what you are doing.
@param majorCompaction True to force a major compaction regardless of thresholds
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java