private void moveHFileToGlobalArchiveDir() throws IOException {
    FileSystem fs = region.getRegionFileSystem().getFileSystem();
    for (HStore store : region.getStores()) {
      store.closeAndArchiveCompactedFiles();
      Path storeArchiveDir = HFileArchiveUtil.getStoreArchivePath(conf, region.getRegionInfo(),
        store.getColumnFamilyDescriptor().getName());
      Path globalStoreArchiveDir = HFileArchiveUtil.getStoreArchivePathForArchivePath(
        globalArchivePath, region.getRegionInfo(), store.getColumnFamilyDescriptor().getName());
      try {
        if (fs.exists(storeArchiveDir)) {
          MasterRegionUtils.moveFilesUnderDir(fs, storeArchiveDir, globalStoreArchiveDir,
            archivedHFileSuffix);
        } else {
          LOG.warn(
            "Archived dir {} does not exist, there is no need to move archived hfiles from {} "
              + "to global dir {} .",
            storeArchiveDir, storeArchiveDir, globalStoreArchiveDir);
        }
      } catch (IOException e) {
        LOG.warn("Failed to move archived hfiles from {} to global dir {}", storeArchiveDir,
          globalStoreArchiveDir, e);
      }
    }
  }
As long as there is no RegionServerServices for a master local region, we need implement the
flush and compaction logic by our own.
<p/>
The flush logic is very simple, every time after calling a modification method in
{@link RegionProcedureStore}, we will call the {@link #onUpdate()} method below, and in this
method, we will check the memstore size and if it is above the flush size, we will call
{@link HRegion#flush(boolean)} to force flush all stores.
<p/>
And for compaction, the logic is also very simple. After flush, we will check the store file
count, if it is above the compactMin, we will do a major compaction.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegionFlusherAndCompactor.java